How to use the @hpcc-js/other.Persist.widgetPropertyWalker function in @hpcc-js/other

To help you get started, we’ve selected a few @hpcc-js/other examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hpcc-systems / Visualization / packages / composite / src / Persist.ts View on Github external
export function deserializeFromObject(widget, state) {
    const promises = [];
    Persist.widgetPropertyWalker(widget, null, (w, item) => {
        w[item.id + "_reset"]();
        if (state.__properties[item.id] !== undefined) {
            switch (item.type) {
                case "widget":
                    const widgetKey = item.id;
                    promises.push(create(state.__properties[item.id]).then((w2: any) => {
                        w2._owner = w;
                        w[widgetKey](w2);
                        return w2;
                    }));
                    break;
                case "widgetArray":
                case "propertyArray":
                    const widgetArrayKey = item.id;
                    const widgetStateArray = state.__properties[item.id];
                    if (widgetStateArray.length) {