Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import createHistory from 'history/lib/createBrowserHistory';
import useQueries from 'history/lib/useQueries';
const Location = canUseDOM ? useQueries(createHistory)() : {};
export default Location;
return function (options) {
var history = useQueries(useBasename(createHistory))(options);
history.__v2_compatible__ = true;
return history;
};
}
return function (options) {
const history = useQueries(useBasename(createHistory))(options)
return history
}
}
return function ({ routes, ...options } = {}) {
const history = useQueries(createHistory)(options)
const transitionManager = createTransitionManager(history, routes)
return { ...history, ...transitionManager }
}
}
/**
* React Static Boilerplate
* https://github.com/koistya/react-static-boilerplate
* Copyright (c) Konstantin Tarkus (@koistya) | MIT license
*/
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import createHistory from 'history/lib/createBrowserHistory';
import useQueries from 'history/lib/useQueries';
const History = canUseDOM ? useQueries(createHistory)() : {};
const Window = canUseDOM ? window : undefined;
const WindowLocation = Window ? Window.location : {};
export default { History, Window, WindowLocation };
return function () {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var routes = _ref.routes;
var options = _objectWithoutProperties(_ref, ['routes']);
var history = useQueries(createHistory)(options);
var transitionManager = createTransitionManager(history, routes);
return _extends({}, history, transitionManager);
};
}
/**
* React Static Boilerplate
* https://github.com/kriasoft/react-static-boilerplate
*
* Copyright © 2015-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import createBrowserHistory from 'history/lib/createBrowserHistory'
import useBeforeUnload from 'history/lib/useBeforeUnload'
import useQueries from 'history/lib/useQueries'
const history = useQueries(useBeforeUnload(createBrowserHistory))()
export default history
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import createHistory from 'history/lib/createBrowserHistory';
import useQueries from 'history/lib/useQueries';
let History;
let Window;
let Document;
if (canUseDOM) {
History = useQueries(createHistory)();
Window = window;
Document = document;
} else {
const emptyFunc = () => {};
History = {
listen: emptyFunc,
pushState: emptyFunc,
};
Window = {
pageXOffset: 0,
pageYOffset: 0,
location: {},
ga: emptyFunc,
export default () => (req, res, next) => {
if (__DEV__) {
return res.render('index', {
html: null,
reduxState: null,
inlineCss: null,
redialProps: null,
helmet: Helmet.rewind(),
});
}
const memoryHistory = useRouterHistory(useQueries(createMemoryHistory))();
const store = configureStore({
history: memoryHistory,
cookies: new CookieDough(req),
i18n: req.i18n,
});
const history = syncHistoryWithStore(memoryHistory, store);
const routes = configureRoutes({
store,
});
const router = { routes };
const historyLocation = history.createLocation(req.url);
const { dispatch, getState } = store;
return match({ routes: router, location: historyLocation }, (error, redirectLocation, renderProps) => { //eslint-disable-line
if (redirectLocation) {
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import createHistory from 'history/lib/createBrowserHistory';
import createMemoryHistory from 'history/lib/createMemoryHistory';
import useQueries from 'history/lib/useQueries';
const location = useQueries(process.env.BROWSER ? createHistory : createMemoryHistory)();
export default location;