Skip to content

Commit 17b12de

Browse files
committed
Move everything but _initRoutes before initialize
1 parent 2ca95c4 commit 17b12de

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/backbone.eventrouter.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,17 @@ const EventRouter = Backbone.EventRouter = Backbone.Router.extend({
1919
* @param {Boolean} [options.routeTriggers]
2020
*/
2121
constructor: function(options) {
22-
options = _.extend({}, options);
22+
_.extend(this, _.pick(options, ['channelName', 'routeTriggers']));
23+
24+
this._ch = Backbone.Radio.channel(_.result(this, 'channelName'));
25+
26+
this.listenTo(this._ch, 'all', this.navigateFromEvent);
2327

2428
// Backbone.Router routes are added first
2529
// Routes can be added after the triggerRoutes with the Backbone.Router API
2630
Backbone.Router.apply(this, arguments);
2731

28-
_.extend(this, _.pick(options, ['channelName', 'routeTriggers']));
29-
30-
this._ch = Backbone.Radio.channel(_.result(this, 'channelName'));
31-
3232
this._initRoutes();
33-
34-
this.listenTo(this._ch, 'all', this.navigateFromEvent);
3533
},
3634

3735
/**

0 commit comments

Comments
 (0)