-
-
Save chrislaughlin/43391e9a8412eae7b670 to your computer and use it in GitHub Desktop.
Worker Queue Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WorkerQueue.createQueue('PrintPeople', function(person) { | |
console.log('Time: ' + new Date()); | |
console.log(person.name); | |
console.log(person.location); | |
}, 1000); | |
WorkerQueue.pushItem('PrintPeople', {name: 'Peter', location: 'london'}); | |
WorkerQueue.pushItem('PrintPeople', {name: 'Paul', location: 'Belfast'}); | |
WorkerQueue.pushItem('PrintPeople', {name: 'John', location: 'Dublin'}); | |
var people = [{name: 'Sam', location: 'NYC'}, {name: 'Max', location: 'France'}]; | |
WorkerQueue.pushItem('PrintPeople', people); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Time: Sun Aug 03 2014 14:44:33 GMT+0100 (BST) | |
Max | |
France | |
Time: Sun Aug 03 2014 14:44:34 GMT+0100 (BST) | |
Sam | |
NYC | |
Time: Sun Aug 03 2014 14:44:35 GMT+0100 (BST) | |
John | |
Dublin | |
Time: Sun Aug 03 2014 14:44:36 GMT+0100 (BST) | |
Paul | |
Belfast | |
Time: Sun Aug 03 2014 14:44:37 GMT+0100 (BST) | |
Peter | |
london |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment