Container
Stratox also comes with a specialized JavaScript container library designed for seamless communication between template views and the application. It allows for efficient data exchange.
Access container
1. Inside component
export function custom({ services })
{
if (services.has("fallback")) {
services.get("fallback");
}
...2. Outside of component
const stratox = new Stratox("#ingress");
const serviceContainer = stratox.container();Container usage
// Example 1
serviceContainer.set("someObject", { test: "Container 1" });
console.log(serviceContainer.get("someObject").test);
// Log response: Container 1
// Example 2
serviceContainer.set("passingAFunction", function(arg1, arg2) {
alert(arg1+" "+arg2);
});
serviceContainer.get("passingAFunction", "Hello", "world!");
// Alert response: Hello world!Stand alone
Method list
Last updated