Skip to content

Commit

Permalink
update moment.js version and create nodejs example
Browse files Browse the repository at this point in the history
- updated moment.js version in vendor folder
- added r.js (require.js)
- created nodejs example

Minor version bump, Security fix

- corrects security advisories 55 & 532

moment/moment#4163
moment/moment#4326

Update package.json and readme.
  • Loading branch information
justbill2020 committed Feb 19, 2021
1 parent 0ad5f84 commit 214b742
Show file tree
Hide file tree
Showing 7 changed files with 36,136 additions and 496 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -149,6 +149,8 @@ Feel free to [open a new issue](https://github.com/SeverinDK/moment-timer/issues
---
## Changelog
#### v1.3.1
Added nodejs example and increased minimum version of moment. See https://github.com/SeverinDK/moment-timer/issues/26
#### v1.3.0
Fixed issue where .stop() would not stop the timer. See https://github.com/SeverinDK/moment-timer/issues/20
#### v1.2.3
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "moment-timer",
"version": "1.3.0",
"version": "1.3.1",
"description": "A moment.js plugin for timers setInterval & setTimeout.",
"main": "lib/moment-timer.js",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions example/index.html → example/browser/index.html
@@ -1,8 +1,8 @@
<html>

<head>
<script src="vendor/moment.js"></script>
<script src="../lib/moment-timer.js"></script>
<script src="../vendor/moment.js"></script>
<script src="../../lib/moment-timer.js"></script>
</head>

<body>
Expand Down
33 changes: 33 additions & 0 deletions example/nodejs/index.js
@@ -0,0 +1,33 @@
const requirejs = require("../vendor/r.js")

requirejs.config({
packages: [{
name: 'moment',
location: '../vendor',
main: 'moment'
}]
})

let moment = requirejs('moment')
let timer = requirejs("../../lib/moment-timer.js")

let timeoutStartTick = new Date().getTime();
let timeout = moment.duration(1000).timer({
loop: false
},
function() {
console.log(`Timeout Callback fired ${(new Date().getTime() - timeoutStartTick)} ms after script was started.`);
});

let limit = 10
let intervalStartTick = new Date().getTime();
let interval = moment.duration(1, "seconds").timer({
loop: true,
wait: 2500,
executeAfterWait: true
},
function() {
limit --;
if (limit == 0) { interval.stop() }
console.log(`Interval Callback fired ${(new Date().getTime() - intervalStartTick)} ms after script was started.`);
});
6,157 changes: 5,666 additions & 491 deletions example/vendor/moment.js

Large diffs are not rendered by default.

0 comments on commit 214b742

Please sign in to comment.