Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
abstract-object
Advanced tools
AbstractObject with Object State Supports and free
method provides.
The derived class should overwrite the initialize
and finalize
methods.
add the Object State Supports and free
method to your class directly.
You must call the _constructor
of the state-able ability in the constructor method.
import {stateable} from 'abstract-object'
export class MyStateObject {
constructor() {
this._constructor.apply(this, arguments)
}
}
stateable(MyStateObject)
export default MyStateObject
Let state-able object supports the event.
import {stateable} from 'abstract-object'
import {eventable} from 'events-ex'
class MyObject {
constructor() {
this._constructor.apply(this, arguments)
}
}
stateable(MyObject)
eventable(MyObject)
Methods:
create
(class, ...): the create
class method uses to create a new object instance(the util.createObject is the same function).
class
: the class constructor to create a new instance....
: the left arguments will be passed into the class constructor.createWith
(class, arguments): the createWith
class method uses to create a new object instance(the util.createObjectWith is the same function).
class
: the class constructor to create a new instance.arguments
(array): the arguments will be passed into the class constructor.initialize(...)
: abstract initialization method after a new instance creating.
...
: the constructor's arguments should be passed into initialize method.finalize
(...): abstract finalization method before the instance destroying.
...
: the free(destroy)'s arguments should be passed into finalize method.init(...)
: abstract initialization method after a new instance creating.
...
: the constructor's arguments should be passed into init method.final
(...): abstract finalization method before the instance destroying.
...
: the free(destroy)'s arguments should be passed into final method.free
(...): free the class instance.
...
: optional arguments will be passed into final method to process.isIniting
(), isInited
(),isDestroying
(), isDestroyed
() object state testing methods:
only added/injected eventable ability:
dispatch
(event, args[, callback]): dispath an event or callback
event
: the event nameargs
: the args are passed to event or callbackcallback
: optional, it will not dispatch event if the callback is exists, unless the callback return false.dispatchError
(error[, callback]):
error
: the error instance.callback
: optional, it will not dispatch 'error'
event if the callback is exists, unless the callback return false.'initing'
: emit before the initialize method'inited'
: emit after the initialize method'destroying'
: emit before the finalize method'destroyed'
: emit after the finalize methodimport {AbstractObject} from 'abstract-object'
class MyObject extends AbstractObject {
initialize(a, b) {
this.a = a
this.b = b
this.cache = {}
}
finalize() {
this.cache = null
}
}
const myObj = new MyObject(1, 2)
RefObject has been moved to ref-object
The RefObject
is derived from AbstractObject. and add the RefCount
and AddRef/Release
Supports.
release()
/free()
: Decrements reference count for this instance.
If it is becoming less than 0, the object would be (self) destroyed.addRef()
: Increments the reference count for this instance
and returns the new reference count.It has been moved to abstract-error.
ref-object.js
, RefObject.js
and eventable-ref-object.js
files
util
to util-ex package.Error
to abstract-error package.FAQs
AbstractObject with Object State Events Support
The npm package abstract-object receives a total of 32 weekly downloads. As such, abstract-object popularity was classified as not popular.
We found that abstract-object demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.