This commit is contained in:
2022-05-30 17:50:04 +03:00
parent 2a6f01f460
commit a44faad823
26 changed files with 772 additions and 393 deletions
+41 -2
View File
@@ -1,9 +1,46 @@
/** @module dataStructures */
__PluginManager__.register('dataStructures', function(module, exports, require, global){
/**
*
* @param context
* @param callback
* @param interval
* @constructor
*/
function Interval(context, callback, interval = 1000){
/** @private */
this.context = context || window;
/** @private */
this.callback = callback;
/** @private */
this.interval = interval;
}
Interval.prototype.start = function () {
/** @private */
this.intervalId = setInterval(function () {
this.callback.apply(this.context, arguments);
}.bind(this), this.interval)
};
Interval.prototype.stop = function () {
if(this.intervalId){
clearInterval(this.intervalId);
}
};
/**
* Stack – LIFO
* Queue – FIFO
* @type dataStructures
* @memberOf kit
*/
var dataStructures = {
const dataStructures = {
StackExecutionLimiter: (function () {
var stack = function (context, callback, timeout = 1000) {
this.counter = 0;
@@ -59,7 +96,9 @@ __PluginManager__.register('dataStructures', function(module, exports, require,
this.counter = 0;
};
return stack;
})()
})(),
Interval,
};
return module.exports = dataStructures;