maishu-chitu
Advanced tools
Comparing version 2.14.0 to 2.15.0
/*! | ||
* | ||
* maishu-chitu v2.14.0 | ||
* maishu-chitu v2.15.0 | ||
* https://github.com/ansiboy/chitu | ||
@@ -314,5 +314,5 @@ * | ||
key: "redirect", | ||
value: function redirect(pageNameOrUrl, args) { | ||
if (!pageNameOrUrl) throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
var page = this.showPageByNameOrUrl(pageNameOrUrl, args); | ||
value: function redirect(pageUrl, args) { | ||
if (!pageUrl) throw Errors_1.Errors.argumentNull('pageUrl'); | ||
var page = this.showPage(pageUrl, args); | ||
var url = this.createUrl(page.name, page.data); | ||
@@ -324,6 +324,6 @@ this.setLocationHash(url); | ||
key: "forward", | ||
value: function forward(pageNameOrUrl, args, setUrl) { | ||
if (!pageNameOrUrl) throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
value: function forward(pageUrl, args, setUrl) { | ||
if (!pageUrl) throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
if (setUrl == null) setUrl = true; | ||
var page = this.showPageByNameOrUrl(pageNameOrUrl, args, true); | ||
var page = this.showPage(pageUrl, args, true); | ||
@@ -334,3 +334,3 @@ if (setUrl) { | ||
} else { | ||
history.pushState(pageNameOrUrl, "", ""); | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
@@ -341,17 +341,2 @@ | ||
}, { | ||
key: "showPageByNameOrUrl", | ||
value: function showPageByNameOrUrl(pageNameOrUrl, args, rerender) { | ||
var pageName; | ||
if (pageNameOrUrl.indexOf('?') < 0) { | ||
pageName = pageNameOrUrl; | ||
} else { | ||
var obj = this.parseUrl(pageNameOrUrl); | ||
pageName = obj.pageName; | ||
args = Object.assign(obj.values, args || {}); | ||
} | ||
return this.showPage(pageName, args, rerender); | ||
} | ||
}, { | ||
key: "reload", | ||
@@ -358,0 +343,0 @@ value: function reload(pageName, args) { |
/*! | ||
* | ||
* maishu-chitu v2.14.0 | ||
* maishu-chitu v2.15.0 | ||
* https://github.com/ansiboy/chitu | ||
@@ -241,6 +241,6 @@ * | ||
} | ||
redirect(pageNameOrUrl, args) { | ||
if (!pageNameOrUrl) | ||
throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
let page = this.showPageByNameOrUrl(pageNameOrUrl, args); | ||
redirect(pageUrl, args) { | ||
if (!pageUrl) | ||
throw Errors_1.Errors.argumentNull('pageUrl'); | ||
let page = this.showPage(pageUrl, args); | ||
let url = this.createUrl(page.name, page.data); | ||
@@ -250,8 +250,8 @@ this.setLocationHash(url); | ||
} | ||
forward(pageNameOrUrl, args, setUrl) { | ||
if (!pageNameOrUrl) | ||
forward(pageUrl, args, setUrl) { | ||
if (!pageUrl) | ||
throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
if (setUrl == null) | ||
setUrl = true; | ||
let page = this.showPageByNameOrUrl(pageNameOrUrl, args, true); | ||
let page = this.showPage(pageUrl, args, true); | ||
if (setUrl) { | ||
@@ -262,18 +262,6 @@ let url = this.createUrl(page.name, page.data); | ||
else { | ||
history.pushState(pageNameOrUrl, "", ""); | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
return page; | ||
} | ||
showPageByNameOrUrl(pageNameOrUrl, args, rerender) { | ||
let pageName; | ||
if (pageNameOrUrl.indexOf('?') < 0) { | ||
pageName = pageNameOrUrl; | ||
} | ||
else { | ||
let obj = this.parseUrl(pageNameOrUrl); | ||
pageName = obj.pageName; | ||
args = Object.assign(obj.values, args || {}); | ||
} | ||
return this.showPage(pageName, args, rerender); | ||
} | ||
reload(pageName, args) { | ||
@@ -280,0 +268,0 @@ let result = this.showPage(pageName, args, true); |
@@ -209,5 +209,5 @@ "use strict"; | ||
key: "redirect", | ||
value: function redirect(pageNameOrUrl, args) { | ||
if (!pageNameOrUrl) throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
var page = this.showPageByNameOrUrl(pageNameOrUrl, args); | ||
value: function redirect(pageUrl, args) { | ||
if (!pageUrl) throw Errors_1.Errors.argumentNull('pageUrl'); | ||
var page = this.showPage(pageUrl, args); | ||
var url = this.createUrl(page.name, page.data); | ||
@@ -219,6 +219,6 @@ this.setLocationHash(url); | ||
key: "forward", | ||
value: function forward(pageNameOrUrl, args, setUrl) { | ||
if (!pageNameOrUrl) throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
value: function forward(pageUrl, args, setUrl) { | ||
if (!pageUrl) throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
if (setUrl == null) setUrl = true; | ||
var page = this.showPageByNameOrUrl(pageNameOrUrl, args, true); | ||
var page = this.showPage(pageUrl, args, true); | ||
@@ -229,3 +229,3 @@ if (setUrl) { | ||
} else { | ||
history.pushState(pageNameOrUrl, "", ""); | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
@@ -236,17 +236,2 @@ | ||
}, { | ||
key: "showPageByNameOrUrl", | ||
value: function showPageByNameOrUrl(pageNameOrUrl, args, rerender) { | ||
var pageName; | ||
if (pageNameOrUrl.indexOf('?') < 0) { | ||
pageName = pageNameOrUrl; | ||
} else { | ||
var obj = this.parseUrl(pageNameOrUrl); | ||
pageName = obj.pageName; | ||
args = Object.assign(obj.values, args || {}); | ||
} | ||
return this.showPage(pageName, args, rerender); | ||
} | ||
}, { | ||
key: "reload", | ||
@@ -253,0 +238,0 @@ value: function reload(pageName, args) { |
@@ -42,5 +42,4 @@ import { IService, ServiceConstructor } from "maishu-chitu-service"; | ||
private setLocationHash; | ||
redirect<T>(pageNameOrUrl: string, args?: object): Page; | ||
forward(pageNameOrUrl: string, args?: object, setUrl?: boolean): Page; | ||
private showPageByNameOrUrl; | ||
redirect<T>(pageUrl: string, args?: object): Page; | ||
forward(pageUrl: string, args?: object, setUrl?: boolean): Page; | ||
reload(pageName: string, args?: object): Page; | ||
@@ -47,0 +46,0 @@ back(): void; |
@@ -137,6 +137,6 @@ define(["require", "exports", "maishu-chitu-service", "./PageMaster", "./Errors"], function (require, exports, maishu_chitu_service_1, PageMaster_1, Errors_1) { | ||
} | ||
redirect(pageNameOrUrl, args) { | ||
if (!pageNameOrUrl) | ||
throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
let page = this.showPageByNameOrUrl(pageNameOrUrl, args); | ||
redirect(pageUrl, args) { | ||
if (!pageUrl) | ||
throw Errors_1.Errors.argumentNull('pageUrl'); | ||
let page = this.showPage(pageUrl, args); | ||
let url = this.createUrl(page.name, page.data); | ||
@@ -146,8 +146,8 @@ this.setLocationHash(url); | ||
} | ||
forward(pageNameOrUrl, args, setUrl) { | ||
if (!pageNameOrUrl) | ||
forward(pageUrl, args, setUrl) { | ||
if (!pageUrl) | ||
throw Errors_1.Errors.argumentNull('pageNameOrUrl'); | ||
if (setUrl == null) | ||
setUrl = true; | ||
let page = this.showPageByNameOrUrl(pageNameOrUrl, args, true); | ||
let page = this.showPage(pageUrl, args, true); | ||
if (setUrl) { | ||
@@ -158,18 +158,6 @@ let url = this.createUrl(page.name, page.data); | ||
else { | ||
history.pushState(pageNameOrUrl, "", ""); | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
return page; | ||
} | ||
showPageByNameOrUrl(pageNameOrUrl, args, rerender) { | ||
let pageName; | ||
if (pageNameOrUrl.indexOf('?') < 0) { | ||
pageName = pageNameOrUrl; | ||
} | ||
else { | ||
let obj = this.parseUrl(pageNameOrUrl); | ||
pageName = obj.pageName; | ||
args = Object.assign(obj.values, args || {}); | ||
} | ||
return this.showPage(pageName, args, rerender); | ||
} | ||
reload(pageName, args) { | ||
@@ -176,0 +164,0 @@ let result = this.showPage(pageName, args, true); |
@@ -36,3 +36,3 @@ { | ||
}, | ||
"version": "2.14.0" | ||
"version": "2.15.0" | ||
} |
@@ -235,6 +235,6 @@ import { IService, ServiceConstructor, Service } from "maishu-chitu-service"; | ||
*/ | ||
public redirect<T>(pageNameOrUrl: string, args?: object): Page { | ||
if (!pageNameOrUrl) throw Errors.argumentNull('pageNameOrUrl') | ||
public redirect<T>(pageUrl: string, args?: object): Page { | ||
if (!pageUrl) throw Errors.argumentNull('pageUrl') | ||
let page = this.showPageByNameOrUrl(pageNameOrUrl, args); | ||
let page = this.showPage(pageUrl, args); | ||
let url = this.createUrl(page.name, page.data); | ||
@@ -252,8 +252,8 @@ this.setLocationHash(url); | ||
*/ | ||
public forward(pageNameOrUrl: string, args?: object, setUrl?: boolean) { | ||
if (!pageNameOrUrl) throw Errors.argumentNull('pageNameOrUrl') | ||
public forward(pageUrl: string, args?: object, setUrl?: boolean) { | ||
if (!pageUrl) throw Errors.argumentNull('pageNameOrUrl') | ||
if (setUrl == null) | ||
setUrl = true | ||
let page = this.showPageByNameOrUrl(pageNameOrUrl, args, true); | ||
let page = this.showPage(pageUrl, args, true); | ||
if (setUrl) { | ||
@@ -264,3 +264,3 @@ let url = this.createUrl(page.name, page.data); | ||
else { | ||
history.pushState(pageNameOrUrl, "", "") | ||
history.pushState(pageUrl, "", "") | ||
} | ||
@@ -271,14 +271,14 @@ | ||
private showPageByNameOrUrl(pageNameOrUrl: string, args?: object, rerender?: boolean) { | ||
let pageName: string | ||
if (pageNameOrUrl.indexOf('?') < 0) { | ||
pageName = pageNameOrUrl | ||
} | ||
else { | ||
let obj = this.parseUrl(pageNameOrUrl); | ||
pageName = obj.pageName; | ||
args = Object.assign(obj.values, args || {}); | ||
} | ||
return this.showPage(pageName, args, rerender); | ||
} | ||
// private showPageByNameOrUrl(pageNameOrUrl: string, args?: object, rerender?: boolean) { | ||
// // let pageName: string | ||
// // if (pageNameOrUrl.indexOf('?') < 0) { | ||
// // pageName = pageNameOrUrl | ||
// // } | ||
// // else { | ||
// // let obj = this.parseUrl(pageNameOrUrl); | ||
// // pageName = obj.pageName; | ||
// // args = Object.assign(obj.values, args || {}); | ||
// // } | ||
// return this.showPage(pageNameOrUrl, args, rerender); | ||
// } | ||
@@ -285,0 +285,0 @@ public reload(pageName: string, args?: object) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
394931
6460