maishu-chitu
Advanced tools
Comparing version 2.16.0 to 2.17.0
/*! | ||
* | ||
* maishu-chitu v2.16.0 | ||
* maishu-chitu v2.17.0 | ||
* https://github.com/ansiboy/chitu | ||
@@ -132,3 +132,2 @@ * | ||
}); | ||
var EmtpyStateData = ""; | ||
var DefaultPageName = "index"; | ||
@@ -268,2 +267,7 @@ | ||
window.addEventListener('hashchange', function () { | ||
if (_this2.location.skip) { | ||
delete _this2.location.skip; | ||
return; | ||
} | ||
showPage(); | ||
@@ -311,4 +315,5 @@ }); | ||
key: "setLocationHash", | ||
value: function setLocationHash(url) { | ||
history.pushState(EmtpyStateData, "", url); | ||
value: function setLocationHash(pageUrl) { | ||
this.location.hash = "#".concat(pageUrl); | ||
this.location.skip = true; | ||
} | ||
@@ -334,4 +339,2 @@ }, { | ||
this.setLocationHash(url); | ||
} else { | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
@@ -373,2 +376,7 @@ | ||
} | ||
}, { | ||
key: "location", | ||
get: function get() { | ||
return location; | ||
} | ||
}]); | ||
@@ -375,0 +383,0 @@ |
/*! | ||
* | ||
* maishu-chitu v2.16.0 | ||
* maishu-chitu v2.17.0 | ||
* https://github.com/ansiboy/chitu | ||
@@ -108,3 +108,2 @@ * | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const EmtpyStateData = ""; | ||
const DefaultPageName = "index"; | ||
@@ -201,2 +200,6 @@ function parseUrl(url) { | ||
window.addEventListener('hashchange', () => { | ||
if (this.location.skip) { | ||
delete this.location.skip; | ||
return; | ||
} | ||
showPage(); | ||
@@ -240,5 +243,9 @@ }); | ||
} | ||
setLocationHash(url) { | ||
history.pushState(EmtpyStateData, "", url); | ||
setLocationHash(pageUrl) { | ||
this.location.hash = `#${pageUrl}`; | ||
this.location.skip = true; | ||
} | ||
get location() { | ||
return location; | ||
} | ||
redirect(pageUrl, args) { | ||
@@ -262,5 +269,2 @@ if (!pageUrl) | ||
} | ||
else { | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
return page; | ||
@@ -267,0 +271,0 @@ } |
@@ -27,3 +27,2 @@ "use strict"; | ||
}); | ||
var EmtpyStateData = ""; | ||
var DefaultPageName = "index"; | ||
@@ -163,2 +162,7 @@ | ||
window.addEventListener('hashchange', function () { | ||
if (_this2.location.skip) { | ||
delete _this2.location.skip; | ||
return; | ||
} | ||
showPage(); | ||
@@ -206,4 +210,5 @@ }); | ||
key: "setLocationHash", | ||
value: function setLocationHash(url) { | ||
history.pushState(EmtpyStateData, "", url); | ||
value: function setLocationHash(pageUrl) { | ||
this.location.hash = "#".concat(pageUrl); | ||
this.location.skip = true; | ||
} | ||
@@ -229,4 +234,2 @@ }, { | ||
this.setLocationHash(url); | ||
} else { | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
@@ -268,2 +271,7 @@ | ||
} | ||
}, { | ||
key: "location", | ||
get: function get() { | ||
return location; | ||
} | ||
}]); | ||
@@ -270,0 +278,0 @@ |
@@ -42,2 +42,3 @@ import { IService, ServiceConstructor } from "maishu-chitu-service"; | ||
private setLocationHash; | ||
private readonly location; | ||
redirect<T>(pageUrl: string, args?: object): Page; | ||
@@ -44,0 +45,0 @@ forward(pageUrl: string, args?: object, setUrl?: boolean): Page; |
define(["require", "exports", "maishu-chitu-service", "./PageMaster", "./Errors"], function (require, exports, maishu_chitu_service_1, PageMaster_1, Errors_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const EmtpyStateData = ""; | ||
const DefaultPageName = "index"; | ||
@@ -96,2 +95,6 @@ function parseUrl(url) { | ||
window.addEventListener('hashchange', () => { | ||
if (this.location.skip) { | ||
delete this.location.skip; | ||
return; | ||
} | ||
showPage(); | ||
@@ -135,5 +138,9 @@ }); | ||
} | ||
setLocationHash(url) { | ||
history.pushState(EmtpyStateData, "", url); | ||
setLocationHash(pageUrl) { | ||
this.location.hash = `#${pageUrl}`; | ||
this.location.skip = true; | ||
} | ||
get location() { | ||
return location; | ||
} | ||
redirect(pageUrl, args) { | ||
@@ -157,5 +164,2 @@ if (!pageUrl) | ||
} | ||
else { | ||
history.pushState(pageUrl, "", ""); | ||
} | ||
return page; | ||
@@ -162,0 +166,0 @@ } |
@@ -36,3 +36,3 @@ { | ||
}, | ||
"version": "2.16.0" | ||
"version": "2.17.0" | ||
} |
@@ -23,3 +23,2 @@ import { IService, ServiceConstructor, Service } from "maishu-chitu-service"; | ||
const EmtpyStateData = ""; | ||
const DefaultPageName = "index" | ||
@@ -165,2 +164,6 @@ export function parseUrl(url: string): { pageName: string, values: PageData } { | ||
window.addEventListener('hashchange', () => { | ||
if(this.location.skip){ | ||
delete this.location.skip | ||
return | ||
} | ||
showPage() | ||
@@ -228,6 +231,13 @@ }) | ||
private setLocationHash(url: string) { | ||
history.pushState(EmtpyStateData, "", url) | ||
private setLocationHash(pageUrl: string) { | ||
// history.pushState(EmtpyStateData, "", url) | ||
this.location.hash = `#${pageUrl}` | ||
this.location.skip = true | ||
} | ||
private get location(): Location & { skip?: boolean } { | ||
return location | ||
} | ||
/** | ||
@@ -264,5 +274,5 @@ * 页面跳转 | ||
} | ||
else { | ||
history.pushState(pageUrl, "", "") | ||
} | ||
// else { | ||
// history.pushState(pageUrl, "", "") | ||
// } | ||
@@ -269,0 +279,0 @@ return page; |
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
396295
6491