Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
mercury-rx
Advanced tools
Readme
Reactive main-loop for the mercury frontend framework
RxJS and mercury are pluggable and not in the dependency tree of this package
'use strict';
var document = require('global/document');
var hgrx = require('mercury-rx');
var hg = require('mercury');
var h = require('mercury').h;
var Rx = require('rx');
var clicks = new Rx.Subject();
clicks.onEvent = clicks.onNext.bind(clicks);
function App() {
return clicks.startWith(0)
.scan(function incrementCounter(state) {
return state + 1;
});
}
App.render = function render(state) {
return h('div.counter', [
'The state ', h('code', 'clickCount'),
' has value: ' + state + '.', h('input.button', {
type: 'button',
value: 'Click me!',
'ev-click': hg.send(clicks.onEvent)
})
]);
};
hgrx.app(hg, document.body, App(), App.render);
'use strict';
var document = require('global/document');
var hgrx = require('mercury-rx');
var hg = require('mercury');
var h = require('mercury').h;
var Rx = require('rx');
var extend = require('xtend');
function App() {
var clicks = new Rx.Subject();
return clicks.startWith({
value: 0,
channels: hgrx.subjectChannels({
clicks: clicks
})
}).scan(function incrementCounter(state) {
var newState = extend(state);
newState.value = newState.value + 1;
return newState;
});
}
App.render = function render(state) {
return h('div.counter', [
'The state ', h('code', 'clickCount'),
' has value: ' + state.value + '.', h('input.button', {
type: 'button',
value: 'Click me!',
'ev-click': hg.send(state.channels.clicks)
})
]);
};
hgrx.app(hg, document.body, App(), App.render);
npm install mercury-rx
function app(
hg: Mercury,
elem: HTMLElement,
state: Observable<any>,
render: (state: any) => VNode,
opts?: any
) : Disposable;
// `channels` is an object like
// { onclick: new Rx.Subject() }
function subjectChannels(channels: any) : any;
This is totally possible. Just implement onNext(value: any)
for subjects
inside subjectChannels
. And implement
subscribe(onNext: (value: any) => void)
for the observable of app
.
FAQs
Reactive main-loop for the mercury frontend framework
The npm package mercury-rx receives a total of 1 weekly downloads. As such, mercury-rx popularity was classified as not popular.
We found that mercury-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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.