
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ThorRx is a tiny Proxy based lib for deliverering events and change records to keep track of mutations on objects (models). When a property is modified on an thor-rx 'observed' instance thor-rx will deliver change notifications that helps you keep track
ThorRx is a tiny Proxy based lib for deliverering events and change records to keep track of mutations on objects (models). When a property is modified on an thor-rx 'observed' instance thor-rx will deliver change notifications that helps you keep track of changes in a smooth way.
npm install thor-rx
Below follows a brief documentation.
Create a new thor-rx observer
let rx = new ThorRx<T>(instance,(changes:ChangeModel) => {});
Get a thor-rx instance of type T. T is the proxied instances of yours.
observerOfT = rx.getObserver();
Where we have an object(Model) Person
let person = new Person();
let rx = new ThorRx<T>(person , (changes:ChangeModel) => {
// do op with changes
});
let rxPerson= rx.getObserver();
// rx person is now a observed (Proxied) instance of Person
Change model contains information about the current change.
class ChangeModel {
target: any;
type: string;
newValue: any;
oldValue: any;
timeStamp: Date;
constructor(target: any, type: string, newValue: any, oldValue: any);
}
An change type can be as follows: add, removed and update.
add and remove relates to Array properties.
The objects you wich to observe must derive (extends) from ThorRxBase.
class MyModel extends ThorRxBase{
constructor(){
super();
..
}
}
Make an property / target of the class that derives from ThorRxBase an observable. Will report changes when modified
Makes a properry ( target) a non observable. Will not report changes when modified
Decorators lets you by decorating properties of your objects(classes) gain control of what attributes that thor-rx captures mutations on. By default the property is observed.
if an @Observe decorator exists on a property , you can control it by settig isObserve:boolean to true/false, if fn:Function is defined fn will be the Fn to be called on property mutations.
Note: will not affect newable properties. See observe and unobserve above.
class Person{
@Observe(false) fullName:string;
@Observe(true) age:number
...
}
The example below creates an thor-rx observer for Person (class)
let personObserver = new ThorRx<Person>(new Person(), (change:ChangeModel) => {
// do op's with the change
});
Where person look needs to extend ThorRxBase such as
class Person extends ThorRxBase {
fullName:string
constructor(){
super();
}
}
To get an observer instance you need to call .getObserver():T such as below.
let personObserver = new ThorRx<Person>(new Person(),(change:ChangeModel) => {
// do op's with the change
});
let person = personObserver.getObserver()
person.fullName = "Sven Erik Magnusson";
Setting the property .fullName will deliver (fire) the changes handler you provded , in this example
(change:ChangeModel) => {
// do op
}
-
FAQs
ThorRx is a tiny Proxy based lib for deliverering events and change records to keep track of mutations on objects (models). When a property is modified on an thor-rx 'observed' instance thor-rx will deliver change notifications that helps you keep track
The npm package thor-rx receives a total of 10 weekly downloads. As such, thor-rx popularity was classified as not popular.
We found that thor-rx demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.