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
import Vue from 'vue'; | |
import VueRouter from 'vue-router'; | |
import applyOnRouterAbortShim from './on-router-abort-shim'; | |
Vue.use(VueRouter); | |
const router = new VueRouter(...); | |
applyOnRouterAbortShim(router); |
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
// self is window proxy in IE<=10, eval handles this | |
var _global = (function () { try { return Function('return this')() } catch (e) {} })() // browsers without CSP, Node | |
|| typeof globalThis !== 'undefined' && globalThis // new and polyfilled browsers/workers CSP, newer Node with broken eval | |
|| typeof self !== 'undefined' && self // old browsers/workers with CSP | |
|| typeof global !== 'undefined' && global // old Node with broken eval | |
|| typeof window !== 'undefined' && window; // fallback for exotic environments |
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
|
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
// inherits from promise class through the chain | |
new ExtendablePromise(resolve => resolve()).then() instanceof Promise === true | |
// inherits from promise subclass through the chain | |
new ExtendablePromise(resolve => resolve()).then() instanceof ExtendablePromise === true | |
// allows for direct calls for ES5 inheritance | |
ExtendablePromise.call(Object.create(ExtendablePromise.prototype), resolve => resolve()).then() |
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
|
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
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { Router, browserHistory, useRouterHistory } from 'react-router'; | |
import { syncHistoryWithStore } from 'react-router-redux'; | |
import { configureStore } from './app/SpreeReactStore'; | |
import routes from './app/routes'; | |
let state = window.__initialState__ || undefined; |
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
// Helper function: Loop through all components in the renderProps object // and returns a new object with the desired key | |
let getPropsFromRoute = (renderProps, componentProps) => { | |
let props = {}; | |
let lastRoute = renderProps.routes[-1]; | |
renderProps.routes.reduceRight((prevRoute, currRoute) => { | |
componentProps.forEach(componentProp => { | |
if (!props[componentProp] && currRoute.component[componentProp]) { | |
props[componentProp] = currRoute.component[componentProp]; | |
} | |
}); |
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
import React from "react"; | |
import PropTypes from "prop-types"; | |
import { createPortal } from "react-dom"; | |
class Portal extends React.Component { | |
static propTypes = { | |
children: PropTypes.node, | |
}; | |
state = { mounted: false }; |
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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import { AppContainer } from "react-hot-loader"; | |
import App from "./App"; | |
const render = (hydrate = false) => { | |
const container = document.querySelector("#app"); | |
const element = ( | |
<AppContainer> |
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
|
NewerOlder