Last active
September 29, 2020 13:14
-
-
Save gladchinda/9dd090c2b5e81194cadda0b9cf29d448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable */ | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import App from './App'; | |
var onCheckoutReady = (function __once__(fn) { | |
if (typeof fn === 'function') { | |
let _invoked = false; | |
return function __invokableFunctionWithOnlyOneInvocation(...args) { | |
if (!_invoked && (_invoked = true)) return fn(...args); | |
}; | |
} | |
return fn; | |
})(function onCheckoutReady(store) { | |
const rootElement = document.getElementById('root'); | |
const { dispatch, getState, subscribe, ...actions } = store; | |
ReactDOM.render( | |
<React.StrictMode> | |
<Provider store={store}> | |
<App actions={actions} /> | |
</Provider> | |
</React.StrictMode>, | |
rootElement | |
); | |
}); | |
(function ready(fn) { | |
if (typeof fn === 'function') { | |
document.addEventListener('checkout:ready', (evt) => { | |
if (Object.prototype.toString.call(evt.detail) === '[object Object]') { | |
fn(evt.detail.store); | |
} | |
}, { once: true }); | |
} | |
})(onCheckoutReady); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment