Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
angular-primus
Advanced tools
Primus provider for Angular.
This plugin works with other Primus plugins like primus-emitter and primus-resource.
bower install angular-primus
angular.module('controllers.primus', ['primus'])
.config(function (primusProvider) {
primusProvider
// Define Primus endpoint.
.setEndpoint('http://mywebsite.com')
// Define Primus options.
.setOptions({
reconnect: {
minDelay: 100,
maxDelay: 60000,
retries: 100
}
})
// Define default multiplex option for resources.
.setDefaultMultiplex(false);
})
.controller('PrimusCtrl', function ($scope, primus) {
// Listen "data" event.
primus.$on('data', function (data) {
$scope.data = data;
});
// Write data.
primus.write('hello');
// Listen custom event using primus-emitter.
primus.$on('customEvent', function (customData) {
$scope.customData = customData;
});
// Listen custom event with a filter (more details below)
// ex. server broadcasting a user account update :
primus.$on('account:update', {userId: 23}, function (account) {
_.merge($scope.account, account);
});
// Send data using primus-emitter.
primus.send('customEvent', { foo: 'bar' });
// Use resource with primus-resource.
primus.$resource('myResource').then(function (myResource) {
myResource.myMethod();
});
});
$filteredOn
takes as filter either :
an object, whom keys will be deep-matched for correspondance with the 1st param of received data, using lodash matches(...). Example of a deep matching :
primus.$on('node:update', {content: {id: 23, type: 'image'}}, …)
a function, taking the received data as arguments and returning true/false = match/don't match
Both $on
and $filteredOn
will call the listener in Angular context, in an optimized way via $evalAsync. So if you have several listeners on the same event, they will all get executed in the same $digest phase.
$filteredOn
will not trigger any apply if the received data doesn't match the given filter. This is desirable if your Angular app is heavy.
MIT
FAQs
Primus provider for Angular.
The npm package angular-primus receives a total of 1 weekly downloads. As such, angular-primus popularity was classified as not popular.
We found that angular-primus 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.