proxy-based Twister client written with react-js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.8 KiB

10 years ago
'use strict';
10 years ago
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
10 years ago
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
10 years ago
var invariant = require('react/lib/invariant');
function throwCannotModify() {
10 years ago
invariant(false, 'You cannot modify a static location');
}
/**
* A location that only ever contains a single path. Useful in
* stateless environments like servers where there is no path history,
* only the path that was used in the request.
*/
var StaticLocation = (function () {
function StaticLocation(path) {
_classCallCheck(this, StaticLocation);
this.path = path;
}
10 years ago
_createClass(StaticLocation, [{
key: 'getCurrentPath',
value: function getCurrentPath() {
return this.path;
}
10 years ago
}, {
key: 'toString',
value: function toString() {
return '<StaticLocation path="' + this.path + '">';
}
}]);
return StaticLocation;
})();
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
StaticLocation.prototype.push = throwCannotModify;
StaticLocation.prototype.replace = throwCannotModify;
StaticLocation.prototype.pop = throwCannotModify;
module.exports = StaticLocation;