introduction
@pumped-fn/core-next
tried its best to stay on very low amount of APIs, it makes programming fun, ease on importing and also LLM-friendly
primitives
executors
Executor is the atom of pumped-fn
. At its heart, it's measely an object to be used as a reference. It contains the factory function, dependencies and metas
Executor has a few references used as signal the scope to treat the graph of dependencies slightly differently
lazy
is a representation of an Executor at the Scope. It gives you the access to the Accessor. It fuels conditional dependency, lazy evalutionreactive
is a Reactive indicator of an Executor at the Scope. When a value depending on a reactive variation, whenever the main Executor got updated, the factory will be triggeredstatic
is a static representation of an Executor at the Scope. Similar to .lazy, the major different isstatic
will also resolve the dependency graph prior to triggering the factory
scope
Scope is a container. Each scope is isolated, and has its own lifecycle, and can be applied using different middlewares. An application can have as many scope as it wants, despite most of them actually requires only one
Scope only know about the Executors which resolve
by it, as such the dependency graph is local to a scope.
middleware
Middleware provides a powerful event-driven system for intercepting and modifying the executor resolution pipeline. It operates through event hooks that are triggered during resolution, update, and release operations.
The middleware system consists of:
- Middleware Interface:
init
anddispose
lifecycle hooks - Event Callbacks:
onChange
for resolve/update events,onRelease
for cleanup - Value Transformation: Return
preset()
to override resolved/updated values