Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
chronoman
Advanced tools
Changelog
1.3.1 / 2020-02-14
action
objects having func
and context
fieldsReadme
Utility class to simplify use of timers created by setTimeout
.
setTimeout
) or recurrent (like setInterval
) timers.recurrent
property),
specified number of times (repeatQty
property) or depending on
result of control function (repeatTest
property).startTime
, stopTime
and executeTime
properties correspondingly.var timer = new Timer({
period: [100, 200, 300, 400, 500, {start: 100, end: 500}],
repeatQty: 100,
passToAction: true,
action: function(tmr) {
console.log("#", tmr.getExecutionQty() + 1, ":", new Date());
},
active: true
});
...
timer.stop();
npm install chronoman
bower install chronoman
Use dist/chronoman.js
or dist/chronoman.min.js
(minified version).
import Timer from "chronoman";
var Timer = require("chronoman").Timer;
define(["path/to/dist/chronoman.js"], function(chronoman) {
var Timer = chronoman.Timer;
...
});
<!-- Use bower_components/chronoman/dist/chronoman.js if the library was installed by Bower -->
<script type="text/javascript" src="path/to/dist/chronoman.js"></script>
<script type="text/javascript">
// сhronoman is available via Chronoman field of window object
var Timer = Chronoman.Timer;
...
</script>
var tmrOne = new Timer({
period: function(timer) {
return 1000 + (timer.getExecutionQty() * 100);
},
action: function(timer) {
console.log("---> Timer one. ", timer);
if (! tmrThree.isActive()) {
tmrThree.start();
}
}
});
var tmrTwo = new Timer();
tmrTwo.setPeriod([2000, , {start: 1000, end: 1500}])
.setRepeatQty(9)
.setPassToAction(true)
.setAction({
i: 0,
execute: function(timer) {
var nI = ++this.i;
console.log("Timer two. #", nI, timer);
tmrOne.setActive(nI % 2 === 1);
}
});
var tmrThree = new Timer()
.setPeriod(3000)
.setRepeatTest(function() {
return tmrTwo.isActive();
});
tmrThree.onExecute = function() {
console.log("* Timer three. #", this.getExecutionQty() + 1);
};
tmrTwo.start();
See test/chronoman.js
for additional examples.
See doc
folder.
This module is inspired by qooxdoo's qx.event.Timer
class.
Copyright (c) 2013-2020 Denis Sikuler
Licensed under the MIT license.
FAQs
Utility class to simplify use of timers created by setTimeout
The npm package chronoman receives a total of 29 weekly downloads. As such, chronoman popularity was classified as not popular.
We found that chronoman demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.