"use strict";
const small_timer_runner_1 = require("../lib/small-timer-runner");
module.exports = (RED) => {
    RED.nodes.registerType('smalltimer', function (props) {
        RED.nodes.createNode(this, props);
        if (props.position) {
            this.position = RED.nodes.getNode(props.position);
            this.smallTimer = new small_timer_runner_1.SmallTimerRunner(this.position, props, this);
            this.on('input', (msg, _send, done) => {
                this.smallTimer.onMessage(msg);
                done();
            });
            this.on('close', () => {
                this.smallTimer.cleanup();
            });
        }
    });
};
