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.
storeon-observable
Advanced tools
A tiny rxjs 6-based middleware for Storeon. Compose and cancel async actions to create side effects and more. (Demo)
The size is only 240 bytes. It uses Size Limit to control size.
Read more about Storeon article.
This module has peer dependencie of rxjs@6.x.x
which will has to be installed as well.
npm install storeon-observable
You need to create epic using RxJS operators. This epic will listen to event ping
, wait for 1 second and map them to a new event, pong
epic.js
import { combineEpics, ofEvent } from 'storeon-observable';
import { mapTo, delay } from 'rxjs/operators'
const epic = action$ => action$.pipe(
ofEvent('ping'),
delay(1000),
mapTo('pong'),
);
export const epics = combineEpics([epic]);
Create store and pass epics
to the createEpicMiddleware
function. It will connect all epics to the Storeon using the storeon-observable
middleware
store.js
import createStore from 'storeon'
import { createEpicMiddleware } from 'storeon-observable';
import { epics } from './epic';
let increment = store => {
store.on('@init', () => ({ isPinging: false }))
store.on('ping', () => ({ isPinging: true }))
store.on('pong', () => ({ isPinging: false }))
}
export const store = createStore([increment, createEpicMiddleware(epics)]);
Using TypeScript you can assign Epic
interface to the function to specify action
and state
typing
epic.ts
import { combineEpics, ofEvent, Epic } from 'storeon-observable';
import { mapTo, delay } from 'rxjs/operators'
interface State {
isPinging: boolean;
}
const epic: Epic<State> = (action$, state$) => action$.pipe(
ofEvent('ping'),
delay(1000),
mapTo('pong'),
);
export const epics = combineEpics([epic]);
This module based on redux-observable.
FAQs
RxJS based module for Storeon which allows to create async actions
The npm package storeon-observable receives a total of 0 weekly downloads. As such, storeon-observable popularity was classified as not popular.
We found that storeon-observable 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’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.