@goldfishjs/route
Advanced tools
Comparing version 1.4.0 to 1.5.0-alpha.0
@@ -34,3 +34,3 @@ /** | ||
protected getPath(): string; | ||
protected getQuery(): Record<string, string | string[]>; | ||
protected getQuery(): Query; | ||
protected setPath(path: string, silent?: boolean): void; | ||
@@ -37,0 +37,0 @@ private isQueryEqual; |
@@ -7,2 +7,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var BaseRouter = /*#__PURE__*/function () { | ||
@@ -12,6 +14,9 @@ function BaseRouter() { | ||
this.fromuKey = 'fromu'; | ||
this.path = ''; | ||
this.query = {}; | ||
this.changeListeners = []; | ||
_defineProperty(this, "fromuKey", 'fromu'); | ||
_defineProperty(this, "path", ''); | ||
_defineProperty(this, "query", {}); | ||
_defineProperty(this, "changeListeners", []); | ||
} | ||
@@ -18,0 +23,0 @@ |
@@ -8,3 +8,3 @@ import BaseRouter, { Query } from './BaseRouter'; | ||
path: string; | ||
query: Record<string, string | string[]>; | ||
query: Query; | ||
}; | ||
@@ -11,0 +11,0 @@ /** |
@@ -19,3 +19,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
@@ -71,17 +71,23 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
_this = _super.apply(this, arguments); | ||
_this.fromuKey = 'fromu'; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this), "fromuKey", 'fromu'); | ||
return _this; | ||
} | ||
/** | ||
* 重新定位到指定 hash 路径,会往 fromu 栈压入元素。 | ||
* | ||
* @param {string} [url] 路径 | ||
* @param {Object?} [params] 需要追加的参数 | ||
*/ | ||
_createClass(StackedRouter, [{ | ||
key: "redirect", | ||
value: function redirect(url, params) { | ||
value: | ||
/** | ||
* 重新定位到指定 hash 路径,会往 fromu 栈压入元素。 | ||
* | ||
* @param {string} [url] 路径 | ||
* @param {Object?} [params] 需要追加的参数 | ||
*/ | ||
function redirect(url, params) { | ||
var _parseUrl2 = parseUrl(url), | ||
@@ -88,0 +94,0 @@ path = _parseUrl2.path, |
@@ -19,3 +19,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
@@ -28,2 +28,4 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import StackedRouter, { format } from './StackedRouter'; | ||
@@ -42,2 +44,5 @@ | ||
_this = _super.call(this); | ||
_defineProperty(_assertThisInitialized(_this), "removeChangeListener", void 0); | ||
_this.removeChangeListener = _this.addChangeListener(function () { | ||
@@ -44,0 +49,0 @@ var realUrl = format(_this.getPath(), _this.getQuery()); |
@@ -11,3 +11,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
@@ -20,2 +20,4 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import Route from './Route'; | ||
@@ -34,4 +36,10 @@ import { default as BaseTinyappRoute } from './container-router/TinyAppRouter'; | ||
_this = _super.apply(this, arguments); | ||
_this.route = new BaseTinyappRoute(); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this), "route", new BaseTinyappRoute()); | ||
return _this; | ||
@@ -38,0 +46,0 @@ } |
@@ -7,2 +7,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var Route = /*#__PURE__*/function () { | ||
@@ -12,4 +14,7 @@ function Route() { | ||
this.path = null; | ||
this.query = {}; | ||
_defineProperty(this, "path", null); | ||
_defineProperty(this, "query", {}); | ||
_defineProperty(this, "removeChangeListener", void 0); | ||
} | ||
@@ -16,0 +21,0 @@ |
{ | ||
"name": "@goldfishjs/route", | ||
"version": "1.4.0", | ||
"version": "1.5.0-alpha.0", | ||
"description": "goldfish-route", | ||
@@ -15,3 +15,3 @@ "main": "lib/index.js", | ||
"author": "644506165@qq.com", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"dependencies": { | ||
@@ -24,10 +24,11 @@ "@goldfishjs/module-usage": "^1.4.0", | ||
"devDependencies": { | ||
"@types/lodash": "4.14.117", | ||
"@types/react": "16.7.3", | ||
"@types/react-dom": "16.0.9", | ||
"lodash": "4.17.19", | ||
"react": "16.6.1", | ||
"react-dom": "16.6.1" | ||
"@types/lodash": "^4.14.117", | ||
"@types/react": "^16.7.3", | ||
"@types/react-dom": "^16.0.9", | ||
"lodash": "^4.17.19", | ||
"react": "^16.6.1", | ||
"react-dom": "^16.6.1" | ||
}, | ||
"sideEffects": false | ||
"sideEffects": false, | ||
"registry": "https://registry.npmjs.org/" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32377
593
2