worktop-quirrel
v0.0.6
Published
A Quirrel client for Worktop
Downloads
2
Readme
This package is currently a work-in-progress and should not be used.
Changes
- [x] Set
self.process.env = self
at runtime - [x] Set
self.window = self
at runtime - [x] Pass fetch to
QuirrelClient
constructor - [x] Remove
credentials: ‘omit’
from fetch requests - [x] Worktop’s
request
object does not useIncomingHttpHeaders
object - [x] Patch
secure-webhooks
dependency to usewebcrypto
instead of Nodecrypto
Example Usage
import { Router } from 'worktop';
import * as Cache from 'worktop/cache';
import { Queue } from 'worktop-quirrel';
const API = new Router();
const ExampleJob = new Queue<Record<string, string>>(
'job/call',
(object) => {
console.log("Job run!");
console.log(object);
return Promise.resolve();
}
);
ExampleJob.addToRouter(API);
API.add('GET', '/job/trigger', async (request, response) => {
await ExampleJob.enqueue({ "example": "payload" }, { delay: 2000 });
response.send(200);
});
Cache.listen(API.run.bind(this));