Closed mrbbot closed 1 year ago
Latest commit: 4a23fbafd0cc5e77e58b71e6a83f6f28c5467a49
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/cloudflare/miniflare/new/bcoll/tre-get-fetcher?filename=.changeset/silver-toes-marry.md&value=---%0A%22%40fake-scope%2Ffake-pkg%22%3A%20patch%0A---%0A%0A%5BMiniflare%203%5D%20Add%20%60getFetcher()%60%20for%20dispatching%20%60fetch%60%2F%60scheduled%60%2F%60queue%60%20events%0A)
Hey! 👋 This change adds back support for dispatching
scheduled
andqueue
events directly. Miniflare 2 previously provided similardispatchScheduled()
anddispatchQueue()
methods, but these implemented an inconsistent, non-standard API.With
getFetcher()
, we're able to reuse magic proxy code to support arbitrary Workers APIs. This is important forqueue()
, which supports sending any structured serialisable as a messagebody
.getFetcher()
also provides an idiomatic Miniflare API for dealing with multiple workers, matching that provided bygetBindings()
.