Comparing version 1.5.0 to 1.5.1
@@ -14,3 +14,3 @@ /** | ||
/** | ||
* emit and event | ||
* emit an event | ||
* @param {string} name event name | ||
@@ -17,0 +17,0 @@ * @param {...*} values values to pass to the event listener |
{ | ||
"name": "a-toolbox", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "isomorphic javascript lightweight basic tools", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -803,7 +803,7 @@ # a-toolbox | ||
emitter.on('event#0', (value0, value1) => { | ||
console.log('event #0 appened with', value0, value1) | ||
console.log('event #0 happened with', value0, value1) | ||
}) | ||
emitter.once('event#0', (value0, value1) => { | ||
console.log('event #0 appened (once) with', value0, value1) | ||
console.log('event #0 happened (once) with', value0, value1) | ||
}) | ||
@@ -822,3 +822,3 @@ | ||
emit and event | ||
emit an event | ||
@@ -844,3 +844,3 @@ _Example_ | ||
emitter.on('event#0', (value0, value1) => { | ||
console.log('event #0 appened (once) with', value0, value1) | ||
console.log('event #0 happened (once) with', value0, value1) | ||
}) | ||
@@ -861,3 +861,3 @@ | ||
emitter.once('event#0', (value0, value1) => { | ||
console.log('event #0 appened (once) with', value0, value1) | ||
console.log('event #0 happened (once) with', value0, value1) | ||
}) | ||
@@ -864,0 +864,0 @@ |
@@ -14,3 +14,3 @@ /** | ||
/** | ||
* emit and event | ||
* emit an event | ||
* @param {string} name event name | ||
@@ -17,0 +17,0 @@ * @param {...*} values values to pass to the event listener |
@@ -11,3 +11,18 @@ const time = require('./time') | ||
* @param {Object} options | ||
* @param {bool} options.chrono measure time, default false | ||
* @param {function} options.done callback when all tasks are completed | ||
* @example | ||
* const tasks = new tools.task.Worker({done: () => { console.log('well done') }}) | ||
* const _asyncOperationTimeout = [500, 1000, 200, 1500, 100]; | ||
* for (const i in _asyncOperationTimeout) { | ||
* _tasks.todo('task#' + i); | ||
* } | ||
* for (const i in _asyncOperationTimeout) { | ||
* setTimeout(function (i) { | ||
* return function () { | ||
* console.log('done task #', i); | ||
* _tasks.done('task#' + i); | ||
* }; | ||
* }(i), _asyncOperationTimeout[i]); | ||
* } | ||
*/ | ||
@@ -21,2 +36,3 @@ Worker: function (options = {}) { | ||
* @param {!string} id | ||
* @test.mode EVENT | ||
* @test.case 'task#1' | ||
@@ -32,5 +48,6 @@ */ | ||
/** | ||
* declare task it's done | ||
* declare task done | ||
* @method Worker.done | ||
* @param {!string} id | ||
* @return {Object|null} if options.chrono is enabled, return elapsed time as {chrono: time ms} | ||
* @test.case 'task#1' | ||
@@ -37,0 +54,0 @@ */ |
19
task.js
@@ -11,3 +11,18 @@ const time = require('./time') | ||
* @param {Object} options | ||
* @param {bool} options.chrono measure time, default false | ||
* @param {function} options.done callback when all tasks are completed | ||
* @example | ||
* const tasks = new tools.task.Worker({done: () => { console.log('well done') }}) | ||
* const _asyncOperationTimeout = [500, 1000, 200, 1500, 100]; | ||
* for (const i in _asyncOperationTimeout) { | ||
* _tasks.todo('task#' + i); | ||
* } | ||
* for (const i in _asyncOperationTimeout) { | ||
* setTimeout(function (i) { | ||
* return function () { | ||
* console.log('done task #', i); | ||
* _tasks.done('task#' + i); | ||
* }; | ||
* }(i), _asyncOperationTimeout[i]); | ||
* } | ||
*/ | ||
@@ -21,2 +36,3 @@ Worker: function (options = {}) { | ||
* @param {!string} id | ||
* @test.mode EVENT | ||
* @test.case 'task#1' | ||
@@ -32,5 +48,6 @@ */ | ||
/** | ||
* declare task it's done | ||
* declare task done | ||
* @method Worker.done | ||
* @param {!string} id | ||
* @return {Object|null} if options.chrono is enabled, return elapsed time as {chrono: time ms} | ||
* @test.case 'task#1' | ||
@@ -37,0 +54,0 @@ */ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
322740
4351