Skip to content

Commit 6408d84

Browse files
committed
feat: add constructor hint
1 parent e4fe767 commit 6408d84

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export default class VueRouter {
3939
afterHooks: Array<?AfterNavigationHook>
4040

4141
constructor (options: RouterOptions = {}) {
42+
if (!(this instanceof VueRouter)) {
43+
warn('router must be called with the new operator.')
44+
}
45+
4246
this.app = null
4347
this.apps = []
4448
this.options = options

0 commit comments

Comments
 (0)