Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

dumbo-ears

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dumbo-ears

Small(ish) listener implementation for Sanity

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

dumbo-ears

npm versionBuild Status

Small(ish) listener implementation for Sanity. Useful if you only need listeners.

Targets

  • Node.js >= 6
  • Modern(ish) browsers (IE >= 11, Chrome, Safari, Firefox etc)

Installation

npm install --save dumbo-ears

Usage

const DumboEars = require('dumbo-ears')

// Instantiate a client
const client = new DumboEars({
  projectId: 'myProjectId',
  dataset: 'myDataset',
  token: 'moop', // optional
})

// Listen for changes on the given query
const subscription = client
  .listen(
    '*[_type == $someType]',
    {someType: 'article'},
    {includePreviousRevision: false}
  )
  .subscribe(mutation => console.log(mutation))

// Unsubscribe from events after 30 seconds
setTimeout(() => {
  subscription.unsubscribe()
}, 30 * 1000)

UMD bundle

You can load this module as a UMD-bundle from unpkg - https://unpkg.com/dumbo-ears
If used in a global browser context, it will be available as window.DumboEars

License

MIT © Espen Hovlandsdal

Keywords

sanity

FAQs

Package last updated on 06 Dec 2018

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