https://github.com/ngnjs/queue
A queue plugin for NGN
https://github.com/ngnjs/queue
async browser deno javascript ngn nodejs queue sync web
Last synced: about 1 year ago
JSON representation
A queue plugin for NGN
- Host: GitHub
- URL: https://github.com/ngnjs/queue
- Owner: ngnjs
- License: mit
- Created: 2020-07-25T05:06:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-28T22:25:55.000Z (over 4 years ago)
- Last Synced: 2025-04-19T23:04:18.115Z (about 1 year ago)
- Topics: async, browser, deno, javascript, ngn, nodejs, queue, sync, web
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 2
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
NGN Queue
A plugin for NGN
The NGN Queue is a collection of functions, stored in the order they're added t othe collection. "Running" a queue executes these functions, in parallel or sequentially.
Documentation for this plugin does not exist yet, but the inline comments in the code are thorough. The unit tests provide use cases, and a series of live examples are available on [codepen](https://codepen.io/coreybutler/pen/eYZQJqL).
The fundamental/basic example:
```javascript
import NGN from 'https://cdn.jsdelivr.net/npm/ngn@latest/index.js'
import Queue from 'https://cdn.jsdelivr.net/npm/@ngnjs/queue/index.js'
const tasks = new Queue()
tasks.add(function () {
console.log('Run task 1')
})
tasks.add(next => {
setTimeout(() => {
console.log('Run async task.')
next()
}, 300)
})
tasks.add('t3', function () {
console.log('Run task named ' + this.name)
})
tasks.on('end', function () {
console.log('All Done!')
})
tasks.runSync()
```