new TimeoutSet(timeout [, refreshRate])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
timeout |
number | ||
refreshRate |
number |
<optional> |
Methods
-
add(value)
-
Insert the specified value in the set.
Parameters:
Name Type Description value
T -
delete(value)
-
Remove the specified value from the set.
Parameters:
Name Type Description value
T Returns:
- Type
- boolean
-
getSize()
-
Return the current size of the set
Returns:
- Type
- number
-
has(value)
-
Return whether the specified value is already in the set
Parameters:
Name Type Description value
T Returns:
- Type
- boolean
-
onEmpty(handler)
-
Define a function to call every time the set becomes empty
Parameters:
Name Type Description handler
function Returns:
this
-
onTimeout(handler)
-
Define a function to call when a value reached the timeout.
Parameters:
Name Type Description handler
function Returns:
this
-
refresh(value)
-
Refresh the timeout of the specified value. Return true if the value was there and so refreshed.
Parameters:
Name Type Description value
T Returns:
- Type
- boolean