"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../Class/Holder");
const _ids_1 = require("../../../_ids");
class Interval extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['ms'],
            o: ['ms'],
            i: [],
        }, {}, system, _ids_1.ID_INTERVAL);
        this._interval = null;
    }
    f({ ms }, done) {
        const { api: { window: { setInterval }, }, } = this.__system;
        // @ts-ignore
        this._interval = setInterval(() => {
            this.pushOutput('ms', ms);
        }, ms);
    }
    d() {
        const { api: { window: { clearInterval }, }, } = this.__system;
        if (this._interval !== null) {
            clearInterval(this._interval);
            this._interval = undefined;
        }
        this._forward_all_empty();
    }
}
exports.default = Interval;
//# sourceMappingURL=index.js.map