Skip to content

Commit 9421217

Browse files
author
vitalii
committed
babel polyfill added
1 parent 0dca542 commit 9421217

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"stage": 0
2+
"presets": ["stage-0", "stage-1", "stage-2", "stage-3", "es2015", "react"]
33
}

lib/RouterMixin.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use strict";
2-
2+
require('babel-polyfill');
33
var React = require('react');
44
var invariant = require('./util/invariant');
55
var assign = Object.assign || require('object-assign');
@@ -184,20 +184,21 @@ var RouterMixin = {
184184

185185
//promise between before and navigation. usefull for ajax request and other async ops
186186
var promise = this.props.promise || function () {return new Promise(resolve=>{resolve()})};
187-
promise().then(()=>{
187+
var _this = this;
188+
promise().then( function () {
188189
if (navigation.onBeforeNavigation &&
189190
navigation.onBeforeNavigation(path, navigation) === false) {
190191
return;
191192
}
192193

193194
//getting actual state
194195
state.matchProps = match.getProps();
195-
this.delegateSetRoutingState(state, function() {
196-
if (this.props.onNavigation) {
197-
this.props.onNavigation();
196+
_this.delegateSetRoutingState(state, function() {
197+
if (_this.props.onNavigation) {
198+
_this.props.onNavigation();
198199
}
199200
cb();
200-
}.bind(this));
201+
}.bind(_this));
201202
});
202203

203204
},

package.json

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
},
1212
"devDependencies": {
1313
"babel": "^5.8.23",
14+
"babel-cli": "6.6.5",
15+
"babel-polyfill": "6.7.4",
16+
"babel-preset-es2015": "6.6.0",
17+
"babel-preset-react": "6.5.0",
18+
"babel-preset-stage-0": "6.5.0",
19+
"babel-preset-stage-1": "6.5.0",
20+
"babel-preset-stage-2": "6.5.0",
21+
"babel-preset-stage-3": "6.5.0",
1422
"browserify": "^11.2.0",
1523
"browserify-shim": "^3.8.10",
1624
"envify": "^3.4.0",

0 commit comments

Comments
 (0)