All Downloads are FREE. Search and download functionalities are using the official Maven repository.

a.hyperscala-ui_2.10.0.9.0.source-code.monitor.js Maven / Gradle / Ivy

The newest version!
var monitor = {
    entries: {},
    createMonitor: function(id, frequency, evaluator) {
        var entry = {
            evaluator: evaluator
        };
        monitor.entries[id] = entry;
        entry.intervalId = setInterval(function() {
            monitor.checkMonitor(id);
        }, frequency);
    },
    checkMonitor: function(id) {
        var entry = monitor.entries[id];
        var result = entry.evaluator();
        if (result != entry.lastValue) {
            realtimeSend('realtime_monitor', 'monitored', {
                elementId: id,
                value: result
            });
            entry.lastValue = result;
        }
    },
    removeMonitor: function(id) {
        var entry = monitor.entries[id];
        if (entry != null) {
            var intervalId = entry.intervalId;
            if (intervalId != null) {
                clearInterval(intervalId);
            }
            monitor.entries[id] = null;
        }
    }
};
window.monitor = monitor;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy