aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/index.umd.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-17 07:45:02 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-17 07:45:02 +0800
commita4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc (patch)
treea9bba8c853d3d4cbbc690621f0e6a7aa13683970 /packages/instant/src/index.umd.ts
parent9a53a29b1f421cdea190b6175dec437ec6d76a39 (diff)
downloaddexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.tar
dexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.tar.gz
dexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.tar.bz2
dexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.tar.lz
dexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.tar.xz
dexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.tar.zst
dexon-sol-tools-a4f6cd21bd289eb2baaee8b6b7d09cbb9e0955dc.zip
feat: be more specific with callback name
Diffstat (limited to 'packages/instant/src/index.umd.ts')
-rw-r--r--packages/instant/src/index.umd.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
index 381c9094b..298b7733f 100644
--- a/packages/instant/src/index.umd.ts
+++ b/packages/instant/src/index.umd.ts
@@ -41,7 +41,7 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
assert.isWeb3Provider('props.provider', config.provider);
}
assert.isString('selector', selector);
- // Render instant and return a callback that allows you to close it.
+ // Render instant and return a callback that allows you to remove it from the DOM.
const renderInstant = () => {
const appendToIfExists = document.querySelector(selector);
assert.assert(!_.isNull(appendToIfExists), `Could not find div with selector: ${selector}`);
@@ -50,21 +50,21 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
injectedDiv.setAttribute('id', INJECTED_DIV_ID);
injectedDiv.setAttribute('class', INJECTED_DIV_CLASS);
appendTo.appendChild(injectedDiv);
- const close = () => appendTo.removeChild(injectedDiv);
+ const removeFromDom = () => appendTo.removeChild(injectedDiv);
const instantOverlayProps = {
...config,
// If we are using the history API, just go back to close
- onClose: () => (config.shouldDisablePushToHistory ? close() : window.history.back()),
+ onClose: () => (config.shouldDisablePushToHistory ? removeFromDom() : window.history.back()),
};
ReactDOM.render(React.createElement(ZeroExInstantOverlay, instantOverlayProps), injectedDiv);
- return close;
+ return removeFromDom;
};
if (config.shouldDisablePushToHistory) {
renderInstant();
} else {
// Before we render, push to history saying that instant is showing for this part of the history.
window.history.pushState({ zeroExInstantShowing: true }, '0x Instant');
- let closeInstant = renderInstant();
+ let removeInstant = renderInstant();
let prevOnPopState = util.boundNoop;
if (window.onpopstate) {
@@ -76,10 +76,10 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
// e.state represents the new state
if (e.state && e.state.zeroExInstantShowing) {
// The user pressed fowards, so re-render instant.
- closeInstant = renderInstant();
+ removeInstant = renderInstant();
} else {
// User pressed back, so close instant.
- closeInstant();
+ removeInstant();
if (!_.isUndefined(config.onClose)) {
config.onClose();
}