HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/shahnamag/front-end/node_modules/thingies/es6/once.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.once = void 0;
const instances = new WeakMap();
/**
 * A class method decorator that limits a method to be called only once. All
 * subsequent calls will return the result of the first call.
 */
function once(fn, context) {
    return function (...args) {
        let map = instances.get(this);
        if (!map)
            instances.set(this, (map = new WeakMap()));
        if (!map.has(fn))
            map.set(fn, fn.apply(this, args));
        return map.get(fn);
    };
}
exports.once = once;