main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
497 bytes
|
Line | |
---|
1 | // API
|
---|
2 | module.exports = abort;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Aborts leftover active jobs
|
---|
6 | *
|
---|
7 | * @param {object} state - current state object
|
---|
8 | */
|
---|
9 | function abort(state)
|
---|
10 | {
|
---|
11 | Object.keys(state.jobs).forEach(clean.bind(state));
|
---|
12 |
|
---|
13 | // reset leftover jobs
|
---|
14 | state.jobs = {};
|
---|
15 | }
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Cleans up leftover job by invoking abort function for the provided job id
|
---|
19 | *
|
---|
20 | * @this state
|
---|
21 | * @param {string|number} key - job id to abort
|
---|
22 | */
|
---|
23 | function clean(key)
|
---|
24 | {
|
---|
25 | if (typeof this.jobs[key] == 'function')
|
---|
26 | {
|
---|
27 | this.jobs[key]();
|
---|
28 | }
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.