A class constructor decorator.
An importScripts
Effect:
import { Effect, Implant, type StateWorker, type Store } from '@sgrud/state';
declare global {
namespace sgrud.state.effects {
function importScripts(...urls: (string | URL)[]): Promise<void>;
}
}
@Implant('importScripts')
export class ImportScriptsEffect extends Effect {
public override function(
this: StateWorker
): Store.Effects['importScripts'] {
return async(...urls) => {
return importScripts(...urls);
};
}
}
Generated using TypeDoc
The Implant decorator, when applied to classes extending the abstract Effect base class, StateHandler.implants the decorated class under the
locate
in the global sgrud.state.effects namespace to be used within StateHandler.dispatched Store.Actions.