abstract-object
Advanced tools
Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1
@@ -49,4 +49,7 @@ "use strict"; | ||
}; | ||
Stateable.prototype.initialize = function () { | ||
if ((0, _utilEx.isFunction)(this.init)) { | ||
(0, _utilEx.defineProperty)(Stateable.prototype, 'initialize', function () { | ||
const self = this.self || this; | ||
if ((0, _utilEx.isFunction)(this.super)) { | ||
return this.super.apply(self, arguments); | ||
} else if ((0, _utilEx.isFunction)(self.init)) { | ||
console.error('init method is deprecated, pls use initialize instead'); | ||
@@ -56,5 +59,16 @@ if (!Stateable.prototype.init) { | ||
} | ||
return this.init.apply(this, arguments); | ||
return self.init.apply(this, arguments); | ||
} | ||
}; | ||
}); | ||
// Stateable.prototype.initialize = function() { | ||
// if (isFunction(this.init)) { | ||
// console.error('init method is deprecated, pls use initialize instead') | ||
// if (!Stateable.prototype.init) { | ||
// Stateable.prototype.init = (function() {}) | ||
// } | ||
// return this.init.apply(this, arguments) | ||
// } | ||
// } | ||
Stateable.prototype.finalize = function () { | ||
@@ -61,0 +75,0 @@ if ((0, _utilEx.isFunction)(this.final)) { |
{ | ||
"name": "abstract-object", | ||
"version": "3.0.0-alpha.0", | ||
"version": "3.0.0-alpha.1", | ||
"description": "AbstractObject with Object State Events Support", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/snowyu/abstract-object", |
@@ -11,6 +11,12 @@ # AbtractObject [![Build Status](https://img.shields.io/travis/snowyu/abstract-object/master.png)](http://travis-ci.org/snowyu/abstract-object) [![npm](https://img.shields.io/npm/v/abstract-object.svg)](https://npmjs.org/package/abstract-object) [![downloads](https://img.shields.io/npm/dm/abstract-object.svg)](https://npmjs.org/package/abstract-object) [![license](https://img.shields.io/npm/l/abstract-object.svg)](https://npmjs.org/package/abstract-object) | ||
You must call the `_constructor` of the state-able ability in the constructor method. | ||
```js | ||
import {stateable} from 'abstract-object' | ||
export class MyStateObject {} | ||
export class MyStateObject { | ||
constructor() { | ||
this._constructor.apply(this, arguments) | ||
} | ||
} | ||
stateable(MyStateObject) | ||
@@ -28,3 +34,7 @@ | ||
class MyObject {} | ||
class MyObject { | ||
constructor() { | ||
this._constructor.apply(this, arguments) | ||
} | ||
} | ||
stateable(MyObject) | ||
@@ -31,0 +41,0 @@ eventable(MyObject) |
@@ -51,4 +51,7 @@ import {AdditionalInjectionMode, createAbilityInjector} from 'custom-ability' | ||
Stateable.prototype.initialize = function() { | ||
if (isFunction(this.init)) { | ||
defineProperty(Stateable.prototype, 'initialize', function() { | ||
const self = this.self || this | ||
if (isFunction(this.super)) { | ||
return this.super.apply(self, arguments) | ||
} else if (isFunction(self.init)) { | ||
console.error('init method is deprecated, pls use initialize instead') | ||
@@ -58,6 +61,16 @@ if (!Stateable.prototype.init) { | ||
} | ||
return this.init.apply(this, arguments) | ||
return self.init.apply(this, arguments) | ||
} | ||
} | ||
}) | ||
// Stateable.prototype.initialize = function() { | ||
// if (isFunction(this.init)) { | ||
// console.error('init method is deprecated, pls use initialize instead') | ||
// if (!Stateable.prototype.init) { | ||
// Stateable.prototype.init = (function() {}) | ||
// } | ||
// return this.init.apply(this, arguments) | ||
// } | ||
// } | ||
Stateable.prototype.finalize = function() { | ||
@@ -64,0 +77,0 @@ if (isFunction(this.final)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
45711
32
1058
154
0