UNPKG

@valkyr/mvc

Version:

A small model view controller implementation for web frameworks.

32 lines 1.92 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var _Debounce_instances, _Debounce_timeout, _Debounce_clear; Object.defineProperty(exports, "__esModule", { value: true }); exports.Debounce = void 0; class Debounce { constructor() { _Debounce_instances.add(this); _Debounce_timeout.set(this, void 0); } run(fn, ms) { __classPrivateFieldGet(this, _Debounce_instances, "m", _Debounce_clear).call(this); __classPrivateFieldSet(this, _Debounce_timeout, setTimeout(fn, ms), "f"); } } exports.Debounce = Debounce; _Debounce_timeout = new WeakMap(), _Debounce_instances = new WeakSet(), _Debounce_clear = function _Debounce_clear() { if (__classPrivateFieldGet(this, _Debounce_timeout, "f") !== undefined) { clearTimeout(__classPrivateFieldGet(this, _Debounce_timeout, "f")); } }; //# sourceMappingURL=Debounce.js.map