Skip to content

Instantly share code, notes, and snippets.

@chrislaughlin
Created August 3, 2014 13:46
Show Gist options
  • Save chrislaughlin/43391e9a8412eae7b670 to your computer and use it in GitHub Desktop.
Save chrislaughlin/43391e9a8412eae7b670 to your computer and use it in GitHub Desktop.
Worker Queue Example
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);
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