-
-
Save luggage66/8cc8440551c48d32bc45 to your computer and use it in GitHub Desktop.
Babel bluebirdCoroutine issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# babel 5.8.23 | |
babel --optional bluebirdCoroutines input.js > output.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Promise from 'bluebird'; | |
export default class MyClass | |
{ | |
constructor() { | |
} | |
async foo() { | |
var result = await Promise.delay('test', 500); | |
console.log(result); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _bluebird = require('bluebird'); | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | |
var _bluebird2 = _interopRequireDefault(_bluebird); | |
var MyClass = (function () { | |
function MyClass() { | |
_classCallCheck(this, MyClass); | |
} | |
_createClass(MyClass, [{ | |
key: 'foo', | |
value: _bluebird.coroutine(function* () { | |
var result = yield _bluebird2['default'].delay('test', 500); | |
console.log(result); | |
}) | |
}]); | |
return MyClass; | |
})(); | |
exports['default'] = MyClass; | |
module.exports = exports['default']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment