timer-wheel
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -39,2 +39,16 @@ "use strict"; | ||
} | ||
/** | ||
* Unschedule an item that has been previously scheduled. | ||
* | ||
* @param data | ||
*/ | ||
ReschedulingTimerWheel.prototype.unschedule = function (data) { | ||
var current = this.items.get(data); | ||
if (current) { | ||
current.remove(); | ||
this.items.delete(data); | ||
return true; | ||
} | ||
return false; | ||
}; | ||
ReschedulingTimerWheel.prototype.removeNode = function (node) { | ||
@@ -41,0 +55,0 @@ this.items.delete(node.data); |
@@ -22,2 +22,16 @@ import { TimerWheel } from './timer-wheel'; | ||
} | ||
/** | ||
* Unschedule an item that has been previously scheduled. | ||
* | ||
* @param data | ||
*/ | ||
unschedule(data) { | ||
const current = this.items.get(data); | ||
if (current) { | ||
current.remove(); | ||
this.items.delete(data); | ||
return true; | ||
} | ||
return false; | ||
} | ||
removeNode(node) { | ||
@@ -24,0 +38,0 @@ this.items.delete(node.data); |
@@ -21,2 +21,8 @@ import { TimerWheel } from './timer-wheel'; | ||
constructor(); | ||
/** | ||
* Unschedule an item that has been previously scheduled. | ||
* | ||
* @param data | ||
*/ | ||
unschedule(data: T): boolean; | ||
protected removeNode(node: TimerNode<T>): void; | ||
@@ -23,0 +29,0 @@ protected scheduleNode(node: TimerNode<T>): import("./handle").TimerHandle; |
{ | ||
"name": "timer-wheel", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Timer wheel for managing expiration of a large amount of items", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -28,2 +28,20 @@ import { TimerWheel } from './timer-wheel'; | ||
/** | ||
* Unschedule an item that has been previously scheduled. | ||
* | ||
* @param data | ||
*/ | ||
public unschedule(data: T): boolean { | ||
const current = this.items.get(data); | ||
if(current) { | ||
current.remove(); | ||
this.items.delete(data); | ||
return true; | ||
} | ||
return false; | ||
} | ||
protected removeNode(node: TimerNode<T>) { | ||
@@ -30,0 +48,0 @@ this.items.delete(node.data); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58774
1188