#
MswPlugin
A plugin to faciliate the integration of Mock Service Worker (MSW) in a modular application.
#
Reference
const plugin = new MswPlugin(runtime, options?: { mswState? })
#
Parameters
runtime: A runtime instance.options: An optional object literal of options:mswState: AnMswStateinstance.
#
Usage
#
Register the plugin
import { FireflyRuntime, MswPlugin } from "@squide/firefly";
const runtime = new FireflyRuntime({
plugins: [x => new MswPlugin(x)]
});
#
Register the plugin with an initial state
import { FireflyRuntime, MswPlugin, MswState } from "@squide/firefly";
const runtime = new FireflyRuntime({
plugins: [x => new MswPlugin(x, {
state: new MswState({
isReady: true
})
})]
});