@plasma-platform/clock-timer
v0.10.5
Published
Counter for promotions
Downloads
54
Readme
Full documentation
install:npm i @plasma-platform/clock-timer -S
Short documentation
Table of Contents
- ClockTimer
- ClockTimer
- ClockTimer
- init
- updateTimer
- getChangedValues
- init
- updateTimer
- getChangedValues
- start
- stop
- calculateTime
- tick
- mergeDeep
ClockTimer
Creates CNT1A promotion timer
ClockTimer
Creates CNT1C promotion timer
ClockTimer
clock-timer model
init
Initializes the timer
Parameters
args
Objectargs.locale
string timer localeargs.count
number? Quantity of ticks for 'counter' timerFace type.args.timerFace
string Timer type (daily | hourly | counter). 'daily' by defaultargs.timerName
string Unique name for the timerargs.startTimeStamp
number? Timer start dateargs.endTimeStamp
number Timer end dateargs.direction
string Timer count direction ('decrement' | 'increment') // TODO: implement direction behaviour
updateTimer
updates timer value(s)
Parameters
changedTime
Object timer changed valuestimerId
number generated id to distinguish which timer to update
Returns boolean
getChangedValues
Compares new and old date and decides which values to change
Parameters
newTime
Object new time object
Returns Object Values to be changed
init
Initializes the timer
Parameters
args
Objectargs.locale
string timer localeargs.count
number? Quantity of ticks for 'counter' timerFace type.args.timerFace
string Timer type (daily | hourly | counter). 'daily' by defaultargs.timerName
string Unique name for the timerargs.startTimeStamp
number? Timer start dateargs.endTimeStamp
number Timer end dateargs.direction
string Timer count direction ('decrement' | 'increment') // TODO: implement direction behaviour
updateTimer
updates timer value(s)
Parameters
changedTime
Object timer changed valuestimerId
number generated id to distinguish which timer to update
Returns boolean
getChangedValues
Compares new and old date and decides which values to change
Parameters
newTime
Object new time object
Returns Object Values to be changed
start
Start clock-timer
stop
Stops clock-timer
calculateTime
Calculates initial time
Parameters
intervalTime
number Interval time (for setInterval function)
Returns (Object | number) 'time' object or 'count' (depends on 'timerFace' property)
tick
Function to be executed every timer tick. Calculates new time or count
Parameters
intervalTime
number clock-timer interval in milliseconds
Returns boolean
mergeDeep
Merges objects
Parameters
Returns object