Skip to content

Commit 35ced72

Browse files
authored
Merge pull request #7 from InDIOS/development
Bump to version 0.1.3
2 parents 7f3816d + 2aed28f commit 35ced72

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
},
1515
"globals": {
1616
"_$": true,
17-
"_$d": true
17+
"_$d": true,
18+
"_$sa": true,
19+
"_$isStr": true
1820
},
1921
"plugins": [
2022
"html"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.1.3
2+
- Optimized link component code.
3+
- Fixed throwing undefined internal issues.
4+
15
0.1.2
26
- Fixed some internal issues.
37
- Fixed class link attribute behavior.

index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ export default class Router {
3636
this._mode = options.mode === 'history' && !!(history.pushState) ? 'history' : 'hash';
3737

3838
this._routes = options.routes.reduce((routes, route) => {
39-
let { path } = route;
40-
let modifier = options.ignoreCase ? 'i' : '';
39+
let { path } = route;
40+
let modifier = options.ignoreCase ? 'i' : '';
4141
let _route = toInternalRoute(route, modifier);
4242
if (typeof path === 'string' && (path === '' || path === '/')) {
4343
this._default = _route;
4444
} else if (!path) {
45-
this._notFound = _route;
46-
return routes;
45+
this._notFound = _route;
46+
return routes;
4747
} else {
4848
routes.push(_route);
4949
}
50-
toPlainRoutes(this, _route, routes, modifier);
50+
toPlainRoutes(this, _route, routes, modifier);
5151
return routes;
5252
}, <InternalRoute[]>[]);
5353

@@ -111,7 +111,7 @@ export default class Router {
111111
params[_params[i]] = match[i + 1];
112112
}
113113

114-
let to = this._buildRouteObject(url, route.name, params, route.state);
114+
let to = this._buildRouteObject(url, route.name, params, route.state);
115115
let ins: RouteTransition = { to };
116116
const prev = this._prev;
117117

@@ -236,7 +236,7 @@ export default class Router {
236236
}
237237
}
238238
this._fallowRoute(url, indexes)(this._component);
239-
this._onChange.forEach(l => { l(); });
239+
this._onChange.forEach(listener => { try { listener(); } catch { } });
240240
}
241241
}
242242

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "trebor-router",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "The Official router library for TreborJS",
55
"main": "lib/router.esm.js",
66
"scripts": {

route-link.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131
afterMount() {
3232
this._updateURL();
3333
this._classes = this.class;
34-
this._path = typeof this.to === 'string' ? this.to : generateUrl(this.$router, this.to);
35-
if (this.tag === 'a') {
36-
this.$refs.link.setAttribute('href', this._path);
37-
}
34+
this._path = _$isStr(this.to) ? this.to : generateUrl(this.$router, this.to);
35+
if (this.tag === 'a') _$sa(this.$refs.link, ['href', this._path]);
3836
this.$router.onUrlChange(() => {
3937
this._updateURL();
4038
this.$update();

0 commit comments

Comments
 (0)