Skip to content
This repository was archived by the owner on Dec 19, 2017. It is now read-only.

Commit 38d95a2

Browse files
committed
rebuild
1 parent 5e698aa commit 38d95a2

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

ko-component-router.js

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -953,25 +953,17 @@ ko.components.register('ko-component-router', {
953953
var ko = require('knockout')
954954
var page = require('page')
955955

956-
function Router(config) {
957-
var self = this
958-
var k
959-
960-
self.component = ko.observable()
961-
self.ctx = ko.observable()
962-
963-
self.config = {
964-
hashbang: false,
965-
basePath: ''
966-
}
956+
function Router() {
957+
this.component = ko.observable()
958+
this.ctx = ko.observable()
967959
}
968960

969961
Router.prototype.start = function(config) {
970-
this.config.basePath = config.basePath || ''
971-
this.config.hashbang = config.hashbang === true
962+
if (config.basePath) {
963+
page.base(config.basePath)
964+
}
972965

973-
page.base(this.config.basePath)
974-
page.start(this.config)
966+
page.start(config)
975967

976968
require('./component')
977969
}
@@ -1000,7 +992,7 @@ Router.prototype.route = function(route) {
1000992

1001993
switch (typeof el) {
1002994
case 'string':
1003-
arg = _getComponentSetter(el)
995+
arg = getComponentSetter(el)
1004996
break
1005997

1006998
default:
@@ -1012,9 +1004,9 @@ Router.prototype.route = function(route) {
10121004

10131005
page.apply(page, args)
10141006

1015-
function _getComponentSetter(el) {
1007+
function getComponentSetter(_el) {
10161008
return function(ctx, next) {
1017-
self.component(el)
1009+
self.component(_el)
10181010
self.ctx(ctx)
10191011
ctx.handled = true
10201012
next()

0 commit comments

Comments
 (0)