Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/stray/robotlegs-utilities-signalmediator
A Signal equivalent for the EventMap
The robotlegs Mediator
makes use of the EventMap
to help with automatic clean-up when the mediator is removed.
Without clean up, memory leaks and duplication of listeners can occur as your views come and go from the stage and your mediators are created and destroyed.
The SignalMediator
provides a SignalMap
to handle this unmapping for you when the mediator is removed.
Usage
Where your mediator makes use of a Signal
- whether injected or on the view - extend SignalMediator
.
Instead of registering a listener with a signal directly, make use of the addToSignal
and addOnceToSignal
methods.
override public function onRegister():void
{
// add normally
addToSignal(someInjectedSignal, someHandler);
// add once
addOnceToSignal(view.submit, submitHandler);
}
The SignalMediator
will then make use of the SignalMap
to add the handlers to these signals, and when the mediator is destroyed the handlers will all be unmapped. (Via the preRemove() method which is called by the MediatorMap
automatically when views leave the stage).
To manually unmap a signal-listener
The sugar methods addToSignal
and addOnceToSignal
are provided for convenience. You can also access the SignalMap
property of the SignalMediator
directly, and you should use this approach to manually remove a signal (for example in response to another signal or a normal event listener):
signalMap.removeFromSignal(someInjectedSignal, someHandler);
You can also use the SignalMap outside of SignalMediator
SignalMap
itself has no dependencies and can be used within a complex view, a service or any other place it might be useful to you. Even a controller if you're into that kind of thing.
Compatibility
This should be compatible with any 1.x robotlegs release, and at least 0.7 and 0.8 releases of signals. The SignalMap makes use of the Vector class - available only in Flash Player 10+. It should be trivial to switch out the Vector for an array if you required FP 9 usage.
FAQs
Unknown package
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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.