Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let history = useBasename(createHistory)({
basename: '/base'
})
// At the /base/hello/world URL:
history.listen(function(location) {
console.log(location.pathname) // /hello/world
console.log(location.basename) // /base
})
history.createPath('/the/path') // /base/the/path
history.push('/the/path') // push /base/the/path
}
{
let history = createHistory()
const { pathname, query, search, state} = history.getCurrentLocation()
console.log(pathname)
console.log(query)
console.log(search)
console.log(state)
}
// TODO: return a parsed version of queryString
return {};
},
stringifyQuery: function(query) {
// TODO: return a query string created from query
return "";
}
})
history.createPath({ pathname: '/the/path', query: { the: 'query' } })
history.push({ pathname: '/the/path', query: { the: 'query' } })
}
{
// Run our app under the /base URL.
let history = useBasename(createHistory)({
basename: '/base'
})
// At the /base/hello/world URL:
history.listen(function(location) {
console.log(location.pathname) // /hello/world
console.log(location.basename) // /base
})
history.createPath('/the/path') // /base/the/path
history.push('/the/path') // push /base/the/path
}
it('should not allow to accept void', () => {
// $ExpectError
const location = parsePath()
const state: {} = location
});
});
it('should allow to use string argument', () => {
const location = parsePath('/test?query#hash')
const state: {} = location
// $ExpectError
const key: string = location
});
history.listenBeforeUnload(function() {
return 'Are you sure you want to leave this page?'
})
}
{
let history = useQueries(createHistory)()
history.listen(function(location) {
console.log(location.query)
})
}
{
let history = useQueries(createHistory)({
parseQueryString: function(queryString) {
// TODO: return a parsed version of queryString
return {};
},
stringifyQuery: function(query) {
// TODO: return a query string created from query
return "";
}
})
history.createPath({ pathname: '/the/path', query: { the: 'query' } })
history.push({ pathname: '/the/path', query: { the: 'query' } })
}
{
// Run our app under the /base URL.
history.listenBeforeUnload(function() {
return 'Are you sure you want to leave this page?'
})
}
{
let history = useQueries(createHistory)()
history.listen(function(location) {
console.log(location.query)
})
}
{
let history = useQueries(createHistory)({
parseQueryString: function(queryString) {
// TODO: return a parsed version of queryString
return {};
},
stringifyQuery: function(query) {
// TODO: return a query string created from query
return "";
}
})
history.createPath({ pathname: '/the/path', query: { the: 'query' } })
history.push({ pathname: '/the/path', query: { the: 'query' } })
}
{
// Run our app under the /base URL.
beforeEach(function () { // BEFORE EACH TEST
this.appHistory = new createBrowserHistory();
this.store = store;
this.appRoot = renderIntoDocument(
);
this.findOnPage = createFinder(this.appRoot);
this.navigate = path => this.appHistory.pushState(null, path);
});
beforeEach(function () { // BEFORE EACH TEST
this.timeout(5000); // see https://mochajs.org/#timeouts
this.appHistory = new createBrowserHistory();
this.store = store;
this.appRoot = renderIntoDocument(
);
this.findOnPage = createFinder(this.appRoot);
this.navigate = path => this.appHistory.pushState(null, path);
});
function createHashHistoryWithoutKey() {
// Avoid persistence of stored data from previous tests.
window.sessionStorage.clear();
return createHashHistory({ queryKey: false });
}
// Object
// .keys(res[lang])
// .forEach((namespace) => {
// i18next.addResourceBundle(lang, namespace, res[lang][namespace], true, true );
// })
// ;
// })
// ;
//
// module.hot.emit('loaded');
// });
// }
const sagaMiddleware = createSagaMiddleware();
const history = createHashHistory();
const initialState = INITIAL_STATE.set(PATH_MESSAGE_FLOW, loadMessageFlow())
.setIn(WATCHERS_PATH, loadWatchers());
console.log("initial state", initialState.toJSON());
const store = createStore(
reducer,
initialState,
composeWithDevTools(
applyMiddleware(sagaMiddleware) as StoreEnhancer,
) as StoreEnhancer,
);
//Register localStorage sync
store.subscribe(() => {