@miniflare/scheduler
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0-rc.2
{ | ||
"name": "@miniflare/scheduler", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0-rc.2", | ||
"description": "Scheduler module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers", | ||
@@ -39,9 +39,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@miniflare/core": "2.0.0-rc.1", | ||
"@miniflare/shared": "2.0.0-rc.1", | ||
"@miniflare/core": "2.0.0-rc.2", | ||
"@miniflare/shared": "2.0.0-rc.2", | ||
"cron-schedule": "^3.0.4" | ||
}, | ||
"devDependencies": { | ||
"@miniflare/shared-test": "2.0.0-rc.1" | ||
"@miniflare/shared-test": "2.0.0-rc.2" | ||
} | ||
} |
# `@miniflare/scheduler` | ||
Scheduler module for [Miniflare](https://github.com/cloudflare/miniflare): a | ||
fun, full-featured, fully-local simulator for Cloudflare Workers | ||
fun, full-featured, fully-local simulator for Cloudflare Workers. See | ||
[⏰ Scheduled Events](https://miniflare.dev/scheduled.html) for more details. | ||
## Example | ||
```js | ||
import { CorePlugin, MiniflareCore } from "@miniflare/core"; | ||
import { VMScriptRunner } from "@miniflare/runner-vm"; | ||
import { Log, LogLevel } from "@miniflare/shared"; | ||
import { SchedulerPlugin, startScheduler } from "@miniflare/scheduler"; | ||
import { MemoryStorage } from "@miniflare/storage-memory"; | ||
export class BadStorageFactory { | ||
storage() { | ||
throw new Error("This example shouldn't need storage!"); | ||
} | ||
} | ||
const plugins = { CorePlugin, SchedulerPlugin }; | ||
const ctx = { | ||
log: new Log(LogLevel.INFO), | ||
storageFactory: new BadStorageFactory(), | ||
scriptRunner: new VMScriptRunner(), | ||
}; | ||
const mf = new MiniflareCore(plugins, ctx, { | ||
modules: true, | ||
script: `export default { | ||
async scheduled(request, env) { | ||
console.log("tick"); | ||
} | ||
}`, | ||
crons: ["* * * * *"], | ||
}); | ||
const scheduler = await startScheduler(mf); // tick, tick, tick, ... | ||
scheduler.dispose(); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9473
41
+ Added@miniflare/core@2.0.0-rc.2(transitive)
+ Added@miniflare/shared@2.0.0-rc.2(transitive)
- Removed@miniflare/core@2.0.0-rc.1(transitive)
- Removed@miniflare/shared@2.0.0-rc.1(transitive)
Updated@miniflare/core@2.0.0-rc.2
Updated@miniflare/shared@2.0.0-rc.2