Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
subscribable-things
Advanced tools
A collection of reactive wrappers for various browser APIs.
This package provides factory functions which can be used to turn browser APIs into subscribable things. A subscribable thing can either be consumed directly with callback functions or by utilzing one of the popular libraries for reactive programming.
The subscribable-things
package is published on npm and can be installed as usual.
npm install subscribable-things
It exports individual functions for each wrapped browser API which are described in greater detail below. They can either be used directly by providing a callback function ...
import { mediaQueryMatch } from 'subscribable-things';
const subscribe = mediaQueryMatch('(max-width:600px)');
const unsubscribe = subscribe((isMatching) => console.log(isMatching));
unsubscribe();
... or by utilizing a library for reactive programming like RxJS ...
import { from } from 'rxjs';
import { mediaQueryMatch } from 'subscribable-things';
const mediaQueryMatch$ = from(mediaQueryMatch('(max-width:600px)'));
const subscription = mediaQueryMatch$.subscribe((isMatching) => console.log(isMatching));
subscription.unsubscribe();
... or Callbags ...
import fromObs from 'callbag-from-obs';
import observe from 'callbag-observe';
import { mediaQueryMatch } from 'subscribable-things';
const source = fromObs(mediaQueryMatch('(max-width:600px)'));
observe((isMatching) => console.log(isMatching))(source);
... or XStream ...
import { mediaQueryMatch } from 'subscribable-things';
import { fromObservable } from 'xstream';
const stream = fromObservable(mediaQueryMatch('(max-width:600px)'));
const unsubscribe = stream.subscribe((isMatching) => console.log(isMatching));
unsubscribe();
... or Bacon.js ...
import { fromESObservable } from 'baconjs';
import { mediaQueryMatch } from 'subscribable-things';
const eventStream = fromESObservable(mediaQueryMatch('(max-width:600px)'));
const unsubscribe = eventStream.onValue((isMatching) => console.log(isMatching));
unsubscribe();
... or Kefir.js.
import { fromESObservable } from 'kefir';
import { mediaQueryMatch } from 'subscribable-things';
const stream = fromESObservable(mediaQueryMatch('(max-width:600px)'));
const subscription = stream.observe({ value (isMatching) { console.log(isMatching); } });
subscription.unsubscribe();
This function is a wrapper for the matchMedia()
method.
This function is a wrapper for the MutationObserver
.
This function is a wrapper for the query()
method of the Permissions API.
This function is a wrapper for the ReportingObserver
of the Reporting API.
FAQs
A collection of reactive wrappers for various browser APIs.
The npm package subscribable-things receives a total of 47,193 weekly downloads. As such, subscribable-things popularity was classified as popular.
We found that subscribable-things demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.