How to use the warp10.serialize function in warp10

To help you get started, we’ve selected a few warp10 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 marko-js / marko-widgets / lib / index.js View on Github external
exports.getInitWidgetsCode = function(widgetsContext) {
    var renderedWidgets = getRenderedWidgets(widgetsContext);
    var ids = renderedWidgets.ids;
    var state = renderedWidgets.state;
    var config = renderedWidgets.config;

    var code = '';

    if (!isObjectEmpty(state)) {
        code += warp10.serialize(
                state,
                WARP10_STATE_SERIALIZATION_OPTIONS) +
                ';\n';
    }

    if (!isObjectEmpty(config)) {
        code += warp10.serialize(
                config,
                WARP10_CONFIG_SERIALIZATION_OPTIONS) +
                ';\n';
    }

    code += '$markoWidgets("' + ids + '");';
    return code;
};
github marko-js / marko-widgets / lib / index.js View on Github external
var renderedWidgets = getRenderedWidgets(widgetsContext);
    var ids = renderedWidgets.ids;
    var state = renderedWidgets.state;
    var config = renderedWidgets.config;

    var code = '';

    if (!isObjectEmpty(state)) {
        code += warp10.serialize(
                state,
                WARP10_STATE_SERIALIZATION_OPTIONS) +
                ';\n';
    }

    if (!isObjectEmpty(config)) {
        code += warp10.serialize(
                config,
                WARP10_CONFIG_SERIALIZATION_OPTIONS) +
                ';\n';
    }

    code += '$markoWidgets("' + ids + '");';
    return code;
};
github marko-js / marko-widgets / lib / index.js View on Github external
}

        var widgetStateDeserializationCode;
        var widgetConfigDeserializationCode;

        if (isObjectEmpty(widgetStateStore)) {
            widgetStateDeserializationCode = '';
        } else {
            widgetStateDeserializationCode = warp10.serialize(widgetStateStore, WARP10_STATE_SERIALIZATION_OPTIONS) +
                    ';\n';
        }

        if (isObjectEmpty(widgetConfigStore)) {
            widgetConfigDeserializationCode = '';
        } else {
            widgetConfigDeserializationCode = warp10.serialize(widgetConfigStore,WARP10_CONFIG_SERIALIZATION_OPTIONS) +
                    ';\n';
        }

        var cspNonce = out.global.cspNonce;
        var nonceAttr = cspNonce ? ' nonce='+JSON.stringify(cspNonce) : '';

        if (immediate) {
            out.write('' +
                widgetStateDeserializationCode +
                widgetConfigDeserializationCode +
                '$markoWidgets("' + ids + '")');
        } else {
            out.write('' +
                widgetStateDeserializationCode +
                widgetConfigDeserializationCode +
                '');
github marko-js / marko-widgets / lib / index.js View on Github external
};

        if (rootWidgetDefs) {
            writeWidgets(rootWidgetDefs);
        } else {
            writeWidgets(rootWidgetDef.children);
            rootWidgetDef.children = [];
        }

        var widgetStateDeserializationCode;
        var widgetConfigDeserializationCode;

        if (isObjectEmpty(widgetStateStore)) {
            widgetStateDeserializationCode = '';
        } else {
            widgetStateDeserializationCode = warp10.serialize(widgetStateStore, WARP10_STATE_SERIALIZATION_OPTIONS) +
                    ';\n';
        }

        if (isObjectEmpty(widgetConfigStore)) {
            widgetConfigDeserializationCode = '';
        } else {
            widgetConfigDeserializationCode = warp10.serialize(widgetConfigStore,WARP10_CONFIG_SERIALIZATION_OPTIONS) +
                    ';\n';
        }

        var cspNonce = out.global.cspNonce;
        var nonceAttr = cspNonce ? ' nonce='+JSON.stringify(cspNonce) : '';

        if (immediate) {
            out.write('' +
                widgetStateDeserializationCode +

warp10

Transport complex JavaScript objects from the server to the web browser at lightning fast speeds

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis