Home

Awesome

<img src="http://rawgit.com/caiogondim/logdown-cast.js/master/logo/banner.svg" />

logdown-cast

<div>  <a href="https://www.npmjs.com/package/logdown-cast"><img src="https://img.shields.io/npm/v/logdown-cast.svg" /></a> </div> <br>

Subscribe to a remote logdown instance in the same machine. Works between different Node processes and browser tabs.

Installation

npm install logdown-cast --save

Usage

// Publish
const logdown = require('logdown')
const cast = require('logdown-cast')

const debug = logdown('foo')
cast.publish(debug)

// Will be published
setInterval(() => debug.log('Hi', Date.now()), 1000)

Then in another process, browser, ...

// Subscribe
const logdown = require('logdown')
const cast = require('logdown-cast')

// Create a logdown object with the prefix you want to subscribe
cast.subscribe(logdown('foo'))

The subscribed instance is a regular logdown instance, which means that you will need to enable logging for it.

Preview

<a href="https://www.youtube.com/watch?v=eIjWB-kV-uU&feature=youtu.be"> <img src="./preview.gif" /> </a>

Reference and credits


caiogondim.com  ·  GitHub @caiogondim  ·  Twitter @caio_gondim