create and use a inheritsLoose helper

This commit is contained in:
Henry Zhu
2017-06-19 11:58:49 -04:00
parent cdca54aed3
commit 8a4ab088e4
8 changed files with 20 additions and 10 deletions

View File

@@ -1,9 +1,9 @@
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass && superClass.prototype); subClass.prototype.constructor = subClass; if (superClass) { subClass.__proto__ = superClass; } }
let B = function B() {};
let A = function (_B) {
_inherits(A, _B);
_inheritsLoose(A, _B);
function A(track) {
if (track !== undefined) {
@@ -15,4 +15,4 @@ let A = function (_B) {
}
return A;
}(B);
}(B);

View File

@@ -1,5 +1,5 @@
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
babelHelpers.inheritsLoose(Test, _Foo);
function Test() {
var _Foo$prototype$test, _Foo$prototype$test2;

View File

@@ -1,5 +1,5 @@
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
babelHelpers.inheritsLoose(Test, _Foo);
function Test() {
var _this = _Foo.call(this) || this;

View File

@@ -1,5 +1,5 @@
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
babelHelpers.inheritsLoose(Test, _Foo);
function Test() {
var _this = _Foo.call(this) || this;

View File

@@ -1,5 +1,5 @@
var BaseController = function (_Chaplin$Controller) {
babelHelpers.inherits(BaseController, _Chaplin$Controller);
babelHelpers.inheritsLoose(BaseController, _Chaplin$Controller);
function BaseController() {
return _Chaplin$Controller.apply(this, arguments) || this;
@@ -9,7 +9,7 @@ var BaseController = function (_Chaplin$Controller) {
}(Chaplin.Controller);
var BaseController2 = function (_Chaplin$Controller$A) {
babelHelpers.inherits(BaseController2, _Chaplin$Controller$A);
babelHelpers.inheritsLoose(BaseController2, _Chaplin$Controller$A);
function BaseController2() {
return _Chaplin$Controller$A.apply(this, arguments) || this;

View File

@@ -1,5 +1,5 @@
var Test = function (_Foo) {
babelHelpers.inherits(Test, _Foo);
babelHelpers.inheritsLoose(Test, _Foo);
function Test() {
return _Foo.apply(this, arguments) || this;