How to use the universal-serialize/src.deserialize function in universal-serialize

To help you get started, we’ve selected a few universal-serialize 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 krakenjs / post-robot / dist / module / lib / serialize.js View on Github external
export function deserializeMessage(source, origin, message) {
    var _deserialize;

    return deserialize(message, (_deserialize = {}, _deserialize[CUSTOM_TYPE.CROSS_DOMAIN_ZALGO_PROMISE] = function (_ref5) {
        var then = _ref5.then;
        return deserializePromise(source, origin, { then: then });
    }, _deserialize[CUSTOM_TYPE.CROSS_DOMAIN_FUNCTION] = function (_ref6) {
        var id = _ref6.id,
            name = _ref6.name;
        return deserializeFunction(source, origin, { id: id, name: name });
    }, _deserialize));
}
github krakenjs / post-robot / src / serialize / serialize.js View on Github external
export function deserializeMessage(source : CrossDomainWindowType | ProxyWindow, origin : string, message : string, { on, send } : { on : OnType, send : SendType }) : T {
    return deserialize(message, {
        [ SERIALIZATION_TYPE.CROSS_DOMAIN_ZALGO_PROMISE ]: (serializedPromise)  => deserializePromise(source, origin, serializedPromise),
        [ SERIALIZATION_TYPE.CROSS_DOMAIN_FUNCTION ]:      (serializedFunction) => deserializeFunction(source, origin, serializedFunction, { on, send }),
        [ SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW ]:        (serializedWindow)   => deserializeWindow(source, origin, serializedWindow, { send })
    });
}