Skip to main content

Remote script features

To use remote script feature (in opposition to local script features, that we've seen previously), you'll need to instantiate WASMO in alongside Izanami.

Moreover, you'll need to set up Izanami connection to WASMO.

Using remote WASMO instance allows leveraging its capabilities regarding script editions and lifecycle. Of course, this implies to instantiate and supervise an additional application.

First, let's create our plugin in WASMO, for this example, we will create an Izanami js plugin.

Let's name it mobile.

We'll one again create a script that returns true if mobile is one of request contexts, and false otherwise. Let's paste following code in WASMO editor :

export function execute() {
let input = JSON.parse(Host.inputString());
Host.outputString(
JSON.stringify({
active: input.executionContext.includes("mobile"),
})
);

return 0;
}

Then click the build button (top right) to build our mobile script.

Now let's get back to Izanami and create a new WASM feature. This time we'll choose to create a WASMO feature.

Once again, let's test our feature, it should be active for mobile context.

It should also be active for prod/mobile subcontext.

And of course it should be inactive for prod context.