Cleaning up the code to use OH 4 features, warn about deprecated stuff in logs, and remove unneeded stuff.
timeUtils:
added deprecation log warnings to deprecated functions
updated test to remove tests for deprecated functions.
timerMgr:
made noop private by changing the name from _noop to #noop
created a getTimerMgr function and export that as a factory. Use var tm = TimerMgr() instead of var tm = new timerMgr.TimerMgr() to instantiate a timer manager
added getTimerMgr to index.js as an export to TimerMgr and added a warning log when one requires timerMgr.
updated deferred.js to use the new factory function
updated test
testUtils:
added comments
reimplemented sleep to use java.lang.Thread instead of a busy wait loop
rulesUtils:
added warning log statements for deprecated functions.
rateLimit:
added a getRateLimit function to export . Use var rl = RateLimit() instead of var rl = new rateLimit.RateLimit() to instantiate
loopingTimer:
added a getLoopingTimer function to export. Use var lt = LoopingTimer() instead of var lt = new loopingTimer.LoopingTimer() to instantiate.
helpers:
use const for constants instead of let
gatekeeper:
made procCommandGenerator private by changing the _ to the #
added getGatekeeper function to export. Use var gk = Gatekeeper() instead of var gk = new gatekeeper.Gatekeeper() to instantiate.
deferred:
made timerBodyGenerator private by replacing _ with #
use time.toZDT() to get now
added getDeferred function to export. Use var d = Deferred() instead of var d = new deferred.Deferred() to instantiate.
countdownTimer:
mande updateItem and iterateGenerator private by replacing _ with #
added getCountdownTimer function to export. Use var ct = CountdownTimer() instead of var ct = new countdownTimer.CountdownTimer() to instantiate.
I'm going to let these changes sit for a few days in case there is a hidden new bug before merging.
Cleaning up the code to use OH 4 features, warn about deprecated stuff in logs, and remove unneeded stuff.
timeUtils:
timerMgr:
noop
private by changing the name from_noop
to#noop
getTimerMgr
function and export that as a factory. Usevar tm = TimerMgr()
instead ofvar tm = new timerMgr.TimerMgr()
to instantiate a timer managergetTimerMgr
to index.js as an export toTimerMgr
and added a warning log when one requirestimerMgr
.deferred.js
to use the new factory functiontestUtils:
rulesUtils:
rateLimit:
getRateLimit
function to export . Usevar rl = RateLimit()
instead ofvar rl = new rateLimit.RateLimit()
to instantiateloopingTimer:
getLoopingTimer
function to export. Usevar lt = LoopingTimer()
instead ofvar lt = new loopingTimer.LoopingTimer()
to instantiate.helpers:
const
for constants instead oflet
gatekeeper:
procCommandGenerator
private by changing the_
to the#
getGatekeeper
function to export. Usevar gk = Gatekeeper()
instead ofvar gk = new gatekeeper.Gatekeeper()
to instantiate.deferred:
timerBodyGenerator
private by replacing_
with#
time.toZDT()
to getnow
var d = Deferred()
instead ofvar d = new deferred.Deferred()
to instantiate.countdownTimer:
updateItem
anditerateGenerator
private by replacing_
with#
getCountdownTimer
function to export. Usevar ct = CountdownTimer()
instead ofvar ct = new countdownTimer.CountdownTimer()
to instantiate.I'm going to let these changes sit for a few days in case there is a hidden new bug before merging.