Skip to content

Commit 4dee3c8

Browse files
committed
make route config methods chainable (close #300)
1 parent 1a6521d commit 4dee3c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class Router {
116116
for (let route in map) {
117117
this.on(route, map[route])
118118
}
119+
return this
119120
}
120121

121122
/**
@@ -136,6 +137,7 @@ class Router {
136137
} else {
137138
this._addRoute(rootPath, handler, [])
138139
}
140+
return this
139141
}
140142

141143
/**
@@ -148,6 +150,7 @@ class Router {
148150
for (let path in map) {
149151
this._addRedirect(path, map[path])
150152
}
153+
return this
151154
}
152155

153156
/**
@@ -160,6 +163,7 @@ class Router {
160163
for (let path in map) {
161164
this._addAlias(path, map[path])
162165
}
166+
return this
163167
}
164168

165169
/**
@@ -170,6 +174,7 @@ class Router {
170174

171175
beforeEach (fn) {
172176
this._beforeEachHooks.push(fn)
177+
return this
173178
}
174179

175180
/**
@@ -180,6 +185,7 @@ class Router {
180185

181186
afterEach (fn) {
182187
this._afterEachHooks.push(fn)
188+
return this
183189
}
184190

185191
/**

0 commit comments

Comments
 (0)