AbstractThe Cloudflare binding type this class wraps.
ProtectedconstructorConstructs a binding accessor.
The Cloudflare binding type this class wraps.
Binding name as declared in wrangler.json, or a function
producing it when first needed.
The name may arrive as a function, and every subclass passes one. Accessors
are created at module scope so a single instance is reused across requests,
and module scope runs while a consumer's imports are still being hoisted,
before it can call configure(). A thunk moves the lookup to first use,
which is inside a request.
Private ReadonlysettleProduces the binding name, on first read.
PrivatesettledThe name once settled, so it is produced only once.
The binding name this instance resolves.
The binding name as declared in wrangler.json.
Checks whether the binding is available on the given environment.
Use this to degrade gracefully when a binding is optional.
The Worker environment.
true when the binding is present.
PrivatelookupResolves the binding, failing fast when it is not configured.
The Worker environment.
The resolved binding.
MissingBindingError When the binding is absent from the environment.
Base class for every Cloudflare binding accessor.
Cloudflare exposes bindings on the per-request
Eobject rather than on a module-level singleton, so an instance never holds the binding itself — it holds the name of the binding and resolves it from theEpassed to each call. That keeps instances safe to create once at module scope and reuse across requests.The name arrives already resolved: subclasses take their settings from
resolve, so neither this class nor its callers know whether a value was defaulted or overridden.Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0