New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@hetrodo/observable

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hetrodo/observable

An observable pattern implementation in nodejs

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

Observable Logo

Downloads

Observable is a simple and lightweight implementation of the observable pattern in nodejs, it fires events when properties are changed.

But note that only the root properties of objects are observed.

Supported types

  • Object
  • Array
  • Primitives (string, number, boolean, null, undefined)

Installation

npm install @hetrodo/observable

Usage

const Observable = require("@hetrodo/observable");

const counter = new Observable(0); //Create a new observable with the initial value of 0

counter.subscribe((value) => {
    console.log(value); //Subscribe to the observable, this will print the value of the observable every time it changes
});

setInterval(() => {
    counter.value++; //Increment the value of the observable every second
}, 1000);

Keywords

observable

FAQs

Package last updated on 27 Oct 2022

Did you know?

Socket

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.

Install

Related posts