Skip to content

Commit 054f470

Browse files
committed
prepare 0.14.0
#56
1 parent cfbaa45 commit 054f470

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

packages/reshow-url/compile.sh

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ stop(){
1616

1717
watch(){
1818
stop
19+
echo "Watch Mode";
1920
npm run build:cjs:ui -- --watch &
2021
npm run build:cjs:src -- --watch &
2122
npm run build:es:ui -- --watch &

packages/reshow-url/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reshow-url",
3-
"version": "0.14.0",
3+
"version": "0.14.1",
44
"description": "reshow url util",
55
"main": "./build/cjs/src/index.js",
66
"module": "./build/es/src/index.js",

packages/reshow-url/src/stores/urlStore.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import arrayDedup from "array.dedup";
88

99
const keys = Object.keys;
1010

11+
/**
12+
* Calling history.pushState() or history.replaceState() won't trigger a popstate event.
13+
* The popstate event is only triggered by performing a browser action, such as clicking on the back button
14+
*
15+
* https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
16+
*/
1117
const updateUrl = (url) => history.pushState && history.pushState("", "", url);
1218

1319
const urlChange = "urlChange";
@@ -55,10 +61,10 @@ class UrlStore extends ReduceStore {
5561
return new URL({});
5662
}
5763

58-
urlChange = () => {
64+
handleUrlChange = () => {
5965
this.nextEmits.push(urlChange);
6066
urlDispatch({ type: "url", url: doc().URL });
61-
ajaxDispatch("urlChange");
67+
ajaxDispatch(urlChange);
6268
};
6369

6470
onUrlChange(cb) {
@@ -69,9 +75,9 @@ class UrlStore extends ReduceStore {
6975
this.removeListener(cb, urlChange);
7076
}
7177

72-
registerEvent(win) {
73-
if (win && win.addEventListener) {
74-
win.addEventListener("popstate", this.urlChange, true);
78+
registerEvent(oWin) {
79+
if (oWin && oWin.addEventListener) {
80+
oWin.addEventListener("popstate", this.handleUrlChange, true);
7581
ajaxStore.urlDispatch = urlDispatch;
7682
}
7783
}

packages/reshow-url/ui/organisms/__tests__/UrlReturnTest.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,24 @@ describe("Test Url Return", () => {
3838
);
3939
}
4040
}
41-
it("test get pathname", () => {
41+
it("test get pathname", (done) => {
4242
const vDom = <FakeComponent urlKey=":pathname" />;
4343
const uFake = mount(vDom).instance();
4444
urlDispatch({ type: "url", url: "http://localhost/aaa" });
45-
expect(uFake.el.props[":pathname"]).to.deep.equal(["", "aaa"]);
45+
setTimeout(() => {
46+
expect(uFake.el.props[":pathname"]).to.deep.equal(["", "aaa"]);
47+
done();
48+
}, 100);
4649
});
4750

48-
it("test get query", () => {
51+
it("test get query", (done) => {
4952
const vDom = <FakeComponent urlKey="foo" />;
5053
const uFake = mount(vDom).instance();
5154
urlDispatch({ type: "query", params: { foo: "bar" } });
52-
expect(uFake.el.props["foo"]).to.equal("bar");
55+
setTimeout(() => {
56+
expect(uFake.el.props["foo"]).to.equal("bar");
57+
done();
58+
}, 100);
5359
});
5460

5561
it("test trigger by history", (done) => {

packages/reshow-url/yarn.lock

+7-6
Original file line numberDiff line numberDiff line change
@@ -1253,9 +1253,9 @@ once@^1.3.0:
12531253
wrappy "1"
12541254

12551255
organism-react-ajax@*:
1256-
version "0.14.0"
1257-
resolved "https://registry.yarnpkg.com/organism-react-ajax/-/organism-react-ajax-0.14.0.tgz#4feb5646c5b178a3f941301e5c4a358bb8f3a4e1"
1258-
integrity sha512-/4+t2qI1FwTCrE8a3LFRO/S09fI48LLi1+Ul6yiHmPmfHFhwIRcnB7xZZWug3+raszTMLMGa7zZlKjDXXpOQOQ==
1256+
version "0.14.1"
1257+
resolved "https://registry.yarnpkg.com/organism-react-ajax/-/organism-react-ajax-0.14.1.tgz#ffc59a4a0b0ac6da5f37546bc78c682cd436d9e6"
1258+
integrity sha512-tdFJT5stecAp8EwsfTaMzMWNuZSggFWE6YUHDJIjwXT/KYjQZ7RScgBEKZsNDcv1xEdaaOPLhAzpI+aRCx59JA==
12591259
dependencies:
12601260
call-func "*"
12611261
es6-promise "4.2.5"
@@ -1537,9 +1537,9 @@ reshow-runtime@*:
15371537
reshow-constant "*"
15381538

15391539
reshow@*:
1540-
version "0.12.11"
1541-
resolved "https://registry.yarnpkg.com/reshow/-/reshow-0.12.11.tgz#785073f0b91fa53e82dd7a6df4d2b4a130942403"
1542-
integrity sha512-dxxAMSDfPLXLDjo/yi5NQzzzl8DsAr3DhBLBmQM1L38mtQOhAUMmGLNeYiJEVp03v/Y0qG8PnyvTIrqRUpPEIQ==
1540+
version "0.14.0"
1541+
resolved "https://registry.yarnpkg.com/reshow/-/reshow-0.14.0.tgz#b6d4e57c23d1ab686ae7d969c28421686df8e5b9"
1542+
integrity sha512-UOreukYZ1B+9cPz1PQCu29A472l735Xva3/CkmeG+Fb5wPqZek3ZmZciAF7ybtwNELPq7GBJqOgqrDALEERwvg==
15431543
dependencies:
15441544
call-func "*"
15451545
get-storage "*"
@@ -1549,6 +1549,7 @@ reshow@*:
15491549
organism-react-popup "*"
15501550
react-atomic-molecule "*"
15511551
reshow-flux "*"
1552+
reshow-return "*"
15521553
reshow-runtime "*"
15531554
seturl "*"
15541555
smooth-scroll-to "*"

0 commit comments

Comments
 (0)