UNPKG

react-router-component

Version:
35 lines (26 loc) 839 B
"use strict"; var Environment = require('./Environment'); var emptyFunction = function() {}; /** * Dummy routing environment which provides no path. * * Should be used on server or in WebWorker. */ function DummyEnvironment() { Environment.call(this); } DummyEnvironment.prototype = Object.create(Environment.prototype); DummyEnvironment.prototype.constructor = DummyEnvironment; DummyEnvironment.prototype.getPath = function() { return null; }; DummyEnvironment.prototype.setPath = function(path, navigation, cb) { // Support old (path, cb) arity if (typeof navigation === 'function' && cb === undefined) { cb = navigation; navigation = {}; } this.path = path; cb(); }; DummyEnvironment.prototype.start = emptyFunction; DummyEnvironment.prototype.stop = emptyFunction; module.exports = DummyEnvironment;