How to use the belter/src.extend function in belter

To help you get started, we’ve selected a few belter 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
setProps(props : (PropsType & P), isUpdate : boolean = false) {

        if (this.component.validate) {
            this.component.validate(this.component, props);
        }

        // $FlowFixMe
        this.props = this.props || {};

        extend(this.props, normalizeProps(this.component, this, props, isUpdate));
    }
github krakenjs / zoid / dist / module / component / child / index.js View on Github external
ChildComponent.prototype.setProps = function setProps(props, origin) {
        var required = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

        // $FlowFixMe
        this.props = this.props || {};
        var normalizedProps = normalizeChildProps(this.parentComponentWindow, this.component, props, origin, required);
        extend(this.props, normalizedProps);

        for (var _i4 = 0, _onPropHandlers2 = this.onPropHandlers, _length4 = _onPropHandlers2 == null ? 0 : _onPropHandlers2.length; _i4 < _length4; _i4++) {
            var handler = _onPropHandlers2[_i4];
            handler.call(this, this.props);
        }

        window.xprops = this.component.xprops = this.props;
    };
github krakenjs / zoid / dist / module / component / parent / index.js View on Github external
ParentComponent.prototype.setProps = function setProps(props) {
        var isUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;


        if (this.component.validate) {
            this.component.validate(this.component, props);
        }

        // $FlowFixMe
        this.props = this.props || {};

        extend(this.props, normalizeProps(this.component, this, props, isUpdate));
    };
github krakenjs / zoid / src / drivers / react.js View on Github external
componentDidMount() {
                component.log(`instantiate_react_component`);
                
                const el = ReactDOM.findDOMNode(this);

                const parent = component.init(extend({}, this.props));
                parent.render(el, CONTEXT.IFRAME);
                this.setState({ parent });
            }
github krakenjs / zoid / src / child / index.js View on Github external
setProps(props : PropsType<p>, origin : string, isUpdate : boolean = false) {
        const helpers = this.getHelpers();
        const existingProps = this.getProps();
        const normalizedProps = normalizeChildProps(this.parentComponentWindow, this.component, props, origin, helpers, isUpdate);

        extend(existingProps, normalizedProps);

        for (const handler of this.onPropHandlers) {
            handler.call(this, existingProps);
        }
    }
</p>
github krakenjs / zoid / src / drivers / react.js View on Github external
componentDidUpdate() {

                if (this.state && this.state.parent) {
                    this.state.parent.updateProps(extend({}, this.props)).catch(noop);
                }
            }
        };