Introduction
asynchronous queue with retry(only peek at first, on success take) javascript implementation.
TOC
Installation
- Install node.js(assume you have allready)
npm install queuetry
Example
playable at tonic
var Q = var q = var i = 0var res = // put first synchronously (before get).q // get what was allready put (above).q // async get because no putq // async get because no putq q // put after get. // Expected output =>// [ 0, 'a' ]// [ 1, 'b' ]// [ 2, 'b' ]
API
Queuetry
Creates queue with retry with capacity of 16.
Queuetry(int capacity)
Creates a queue with retry with length of len.
put(item)
Put item in queue.
getAsync(f)
take item from queue, but only if f returns true.
Code coverage
======== Coverage summary ========
Statements : 100% ( 17/17 )
Branches : 100% ( 6/6 )
Functions : 100% ( 3/3 )
Lines : 100% ( 17/17 )
==================================
Acknowledgement
Many thanks to in no particular order:
- Node.js for server-side javascript(V8)
- Github for providing my project
- Petka Antonov for deque and for template README/LICENSE
- Browserify for making this package available on client-side
- npm for hosting my [package](.
- Mocha for testing my code.
- Istanbal for test coverage.
- Tonic for providing playable snippet.