API Reference
Configuration File Winnetoujs package Constructos Mutables State Management Mutations Select Methods Winnetou Fx Router Translations Color Themes WBR Compiler
Docs Change Log Git Hub Pull Requests Guidelines Get in touch

Mutables


∯ Purpose

Stores data and updates constructos dynamically. Mutables can be handled with winnetou.js node package.

∯ setMutable

Create or update a mutable and sets its value. It will be stored in client browser by default unless you set notPersist as false.

Syntax

setMutable(name:string, value:string, notPersistent?:'notPersistent'|boolean)

Returns

Void

Example

mutables.js

import {Winnetou} from 'winnetoujs';
...
Winnetou.setMutable("name","John"); // it will persist by default
Winnetou.setMutable("age","24",false);
Winnetou.setMutable("gender","male","notPersistent");

  

∯ getMutable

Retrieves a stored value of mutable.

Syntax

getMutable(mutable_name:string)

Returns

value:string

Example

mutables.js

import {Winnetou} from 'winnetoujs';
...
let userName = Winnetou.getMutable("name");
console.log(userName) // John

  

∯ initMutable

Initializes a mutable in ephemeral mode and returns its name.

Syntax

initMutable(value:string)

Returns

mutable_name:string

State

Ephemeral (will be delete on page reload)

Example

Setting mutable name with value John .

mutables.js

import {Winnetou} from 'winnetoujs';
...
let user2 = Winnetou.initMutable('Anna');