Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Last active September 29, 2020 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gladchinda/9dd090c2b5e81194cadda0b9cf29d448 to your computer and use it in GitHub Desktop.
Save gladchinda/9dd090c2b5e81194cadda0b9cf29d448 to your computer and use it in GitHub Desktop.
/* 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