Comparing version 9.0.51 to 9.0.53
{ | ||
"name": "zoid", | ||
"version": "9.0.51", | ||
"version": "9.0.53", | ||
"description": "Cross domain components.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -89,2 +89,6 @@ /* @flow */ | ||
type InternalState = {| | ||
visible : boolean | ||
|}; | ||
type GetProxyContainer = (container : string | HTMLElement) => ZalgoPromise<ProxyObject<HTMLElement>>; | ||
@@ -104,2 +108,4 @@ type Show = () => ZalgoPromise<void>; | ||
type WatchForUnload = () => ZalgoPromise<void>; | ||
type GetInternalState = () => ZalgoPromise<InternalState>; | ||
type SetInternalState = (InternalState) => ZalgoPromise<InternalState>; | ||
@@ -122,3 +128,5 @@ type ParentDelegateOverrides<P> = {| | ||
openPrerender : OpenPrerender, | ||
watchForUnload : WatchForUnload | ||
watchForUnload : WatchForUnload, | ||
getInternalState : GetInternalState, | ||
setInternalState : SetInternalState | ||
|}; | ||
@@ -162,2 +170,5 @@ | ||
const state = {}; | ||
let internalState = { | ||
visible: true | ||
}; | ||
const event = overrides.event ? overrides.event : eventEmitter(); | ||
@@ -170,4 +181,2 @@ const props = overrides.props ? overrides.props : getDefaultProps(); | ||
let visible : boolean = true; | ||
const onErrorOverride : ?OnError = overrides.onError; | ||
@@ -187,2 +196,4 @@ let getProxyContainerOverride : ?GetProxyContainer = overrides.getProxyContainer; | ||
let watchForUnloadOverride : ?WatchForUnload = overrides.watchForUnload; | ||
const getInternalStateOverride : ?GetInternalState = overrides.getInternalState; | ||
const setInternalStateOverride : ?SetInternalState = overrides.setInternalState; | ||
@@ -234,2 +245,23 @@ const getPropsForChild = (domain : string | RegExp) : ZalgoPromise<PropsType<P>> => { | ||
const getInternalState = () => { | ||
return ZalgoPromise.try(() => { | ||
if (getInternalStateOverride) { | ||
return getInternalStateOverride(); | ||
} | ||
return internalState; | ||
}); | ||
}; | ||
const setInternalState = (newInternalState) => { | ||
return ZalgoPromise.try(() => { | ||
if (setInternalStateOverride) { | ||
return setInternalStateOverride(newInternalState); | ||
} | ||
internalState = { ...internalState, ...newInternalState }; | ||
return internalState; | ||
}); | ||
}; | ||
const getProxyWindow = () : ZalgoPromise<ProxyWindow> => { | ||
@@ -306,8 +338,6 @@ if (getProxyWindowOverride) { | ||
return ZalgoPromise.try(() => { | ||
visible = true; | ||
if (currentProxyContainer) { | ||
return currentProxyContainer.get().then(showElement); | ||
} | ||
}); | ||
return ZalgoPromise.hash({ | ||
setState: setInternalState({ visible: true }), | ||
showElement: currentProxyContainer ? currentProxyContainer.get().then(showElement) : null | ||
}).then(noop); | ||
}; | ||
@@ -320,8 +350,6 @@ | ||
return ZalgoPromise.try(() => { | ||
visible = false; | ||
if (currentProxyContainer) { | ||
return currentProxyContainer.get().then(hideElement); | ||
} | ||
}); | ||
return ZalgoPromise.hash({ | ||
setState: setInternalState({ visible: false }), | ||
showElement: currentProxyContainer ? currentProxyContainer.get().then(hideElement) : null | ||
}).then(noop); | ||
}; | ||
@@ -732,4 +760,5 @@ | ||
// $FlowFixMe | ||
prerenderFrame: proxyPrerenderFrame ? proxyPrerenderFrame.get() : null | ||
}).then(({ container, frame, prerenderFrame }) => { | ||
prerenderFrame: proxyPrerenderFrame ? proxyPrerenderFrame.get() : null, | ||
internalState: getInternalState() | ||
}).then(({ container, frame, prerenderFrame, internalState: { visible } }) => { | ||
const innerContainer = renderTemplate(containerTemplate, { context, uid, container, frame, prerenderFrame, doc: document }); | ||
@@ -829,3 +858,3 @@ if (innerContainer) { | ||
const childOverridesPromise = send(target, `${ POST_MESSAGE.DELEGATE }_${ name }`, { | ||
overrides: { props: delegateProps, event, close, onError } | ||
overrides: { props: delegateProps, event, close, onError, getInternalState, setInternalState } | ||
}).then(({ data: { parent } }) => { | ||
@@ -832,0 +861,0 @@ clean.register(() => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2944552
21291