Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abstract-object

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-object - npm Package Compare versions

Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1

test/stateable-test.js

22

lib/stateable.js

@@ -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)) {

2

package.json
{
"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)) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc