Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lzimul/timer-mission
Timer Mission
https://github.com/lzimul/timer-mission
Last synced: 5 days ago
JSON representation
Timer Mission
- Host: GitHub
- URL: https://github.com/lzimul/timer-mission
- Owner: lZiMUl
- License: apache-2.0
- Created: 2021-10-16T09:32:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-03T06:31:02.000Z (over 3 years ago)
- Last Synced: 2025-01-18T13:34:43.868Z (18 days ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# timer-mission
install the dependency:
```
npm install timer-mission --save
```### use the instance.
```js
'use strict';// import dependency
import TimerMission from 'timer-mission';// setting event
const timerMission = new TimerMission([{
"event": "goToWork",
"timer": "6:15:0"
}, {
"event": "goOffWork",
"timer": "22:30:15"
}]);// monitor event
timerMission.addEventListener('goToWork', function () {
console.log(...arguments);
});timerMission.addEventListener('goOffWork' function () {
console.log(...arguments);
});
```## or use class
```js
'use strict';// import dependency
import TimerMission from 'timer-mission';// definition method class
class Demo extends TimerMission {
constructor() {
super(...arguments);
// monitor event
super.addEventListener('goToWork', function () {
console.log(...arguments);
});
super.addEventListener('goOffWork' function () {
console.log(...arguments);
});
}
};new Demo([{
"event": "goToWork",
"timer": "6:15:0"
}, {
"event": "goOffWork",
"timer": "22:30:15"
}]);
```