How to use the post-robot/src.serializeMessage function in post-robot

To help you get started, we’ve selected a few post-robot 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 / zoid / src / component / parent / index.js View on Github external
buildChildPayload({ proxyWin, initialDomain, domain, target = window, context, uid } : { proxyWin : ProxyWindow, initialDomain : string, domain : string | RegExp, target : CrossDomainWindowType, context : $Values, uid : string } = {}) : ChildPayload {

        let childPayload : ChildPayload = {
            uid,
            context,
            domain:  getDomain(window),
            tag:     this.component.tag,
            parent:  this.getWindowRef(target, initialDomain, uid, context),
            props:   this.getPropsRef(proxyWin, target, domain, uid),
            exports: serializeMessage(proxyWin, domain, this.buildParentExports(proxyWin))
        };

        return childPayload;
    }
github krakenjs / zoid / src / component / parent / index.js View on Github external
getPropsRef(proxyWin : ProxyWindow, target : CrossDomainWindowType, domain : string | RegExp, uid : string) : PropRef {
        let value = serializeMessage(proxyWin, domain, this.getPropsForChild(domain));

        let propRef = isSameDomain(target)
            ? { type: INITIAL_PROPS.RAW, value }
            : { type: INITIAL_PROPS.UID, uid };

        if (propRef.type === INITIAL_PROPS.UID) {
            global.props[uid] = value;

            this.clean.register(() => {
                delete global.props[uid];
            });
        }

        return propRef;
    }
github krakenjs / zoid / src / parent / index.js View on Github external
buildChildPayload({ proxyWin, childDomain, domain, target = window, context, uid } : { proxyWin : ProxyWindow, childDomain : string, domain : string | RegExp, target : CrossDomainWindowType, context : $Values, uid : string } = {}) : ChildPayload {
        return {
            uid,
            context,
            version:      __ZOID__.__VERSION__,
            childDomain,
            parentDomain: getDomain(window),
            tag:          this.component.tag,
            parent:       this.getWindowRef(target, childDomain, uid, context),
            props:        this.getPropsRef(proxyWin, childDomain, domain, uid),
            exports:      serializeMessage(proxyWin, domain, this.buildParentExports(proxyWin))
        };
    }
github krakenjs / zoid / src / parent / index.js View on Github external
getPropsRef(proxyWin : ProxyWindow, childDomain : string, domain : string | RegExp, uid : string) : PropRef {
        const value = serializeMessage(proxyWin, domain, this.getPropsForChild(domain));

        const propRef = (childDomain === getDomain())
            ? { type: INITIAL_PROPS.UID, uid }
            : { type: INITIAL_PROPS.RAW, value };

        if (propRef.type === INITIAL_PROPS.UID) {
            const global = getGlobal(window);
            global.props = global.props || {};
            global.props[uid] = value;

            this.clean.register(() => {
                delete global.props[uid];
            });
        }

        return propRef;
github krakenjs / zoid / dist / module / component / parent / index.js View on Github external
proxyWin = _ref7.proxyWin,
            initialDomain = _ref7.initialDomain,
            domain = _ref7.domain,
            _ref7$target = _ref7.target,
            target = _ref7$target === undefined ? window : _ref7$target,
            context = _ref7.context,
            uid = _ref7.uid;

        var childPayload = {
            uid: uid,
            context: context,
            domain: getDomain(window),
            tag: this.component.tag,
            parent: this.getWindowRef(target, initialDomain, uid, context),
            props: this.getPropsRef(proxyWin, target, domain, uid),
            exports: serializeMessage(proxyWin, domain, this.buildParentExports(proxyWin))
        };

        return childPayload;
    };