Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/router / src / makeHistory.ts
Size: Mime:
/**
 * @file what this does, is load an *in-memory* polyfill of `history` when
 *       on server, or in test
 * @api https://www.npmjs.com/package/history
 */
let history
if (
  typeof window !== 'object' ||
  process.env.BUILD_FLAG_IS_SERVER === 'true' ||
  process.env.NODE_ENV === 'test'
) {
  // console.log('memoryHistory')
  history = require('history/createMemoryHistory').default
} else {
  // console.log('browserHistory')
  history = require('history/createBrowserHistory').default
}

let created
const makeHistory = (props?: any) => {
  if (created !== undefined) {
    return created
  }
  created = history()
  return created
}

export { makeHistory }
export default makeHistory