@sanity/document-window

2.0.9 • Public • Published

Sanity document window

Give it a query and it will keep that window up to date with changes.

Installing

npm install --save @sanity/document-window

Warning

API is still in flux and is likely to change in the near future. Use at your own risk.

Usage

const SanityClient = require('@sanity/client')
const DocumentWindow = require('@sanity/document-window')

const client = new SanityClient({
  projectId: 'your-project-id',
  dataset: 'some-dataset',
  useCdn: true
})

const query = new DocumentWindow.Query()
  .constraint('_type == $type && numSeats >= 2')
  .params({type: 'product'})
  .order([['numSeats', 'desc'], ['_updatedAt', 'desc']])
  .from(0)
  .to(20)

const articleWindow = new DocumentWindow({client, query})
articleWindow.on('data', docs => {
  console.log(docs)
})

License

MIT-licensed. See LICENSE.

Package Sidebar

Install

npm i @sanity/document-window

Weekly Downloads

65

Version

2.0.9

License

MIT

Unpacked Size

45.4 kB

Total Files

17

Last publish

Collaborators

  • kmelve
  • bjoerge
  • rexxars
  • skogsmaskin
  • tonina
  • mattcraig
  • joneidejohnsen
  • rubioz
  • robinpyon
  • mariuslundgard
  • sanity-io
  • evenw
  • radhe_sanity
  • rbotten
  • danielsgroves
  • judofyr
  • ryanblock
  • obliadp
  • dcilke
  • madken
  • fredcarlsen
  • hermanw
  • tambet
  • sgulseth
  • atombender
  • simeonsanity
  • stipsan
  • snorreeb
  • rankers
  • rdunk
  • michael-sanity
  • vincentquigley
  • ritasdias
  • kenjonespizza
  • josh_sanity_io
  • cngonzalez-sanity
  • jjburbridge
  • tdfka_rick
  • svirs
  • ryanbonial-sanity
  • indrek.karner
  • ash
  • sergeisarviro
  • refiito
  • drewsanity
  • kaspar.lippmaa.sanity
  • dam
  • simen.svale
  • tbeseda
  • daniel.malmer
  • jordanl17
  • colepeters
  • armandocerna
  • joan_miralles_paez
  • christianhg
  • pedro-sanity
  • jwoods-sanity
  • ricokahler
  • tiit.kass.saity
  • binoy14
  • pauloborgesf
  • ausha
  • chrislarocquesanity
  • rostimelk
  • mattlewine.sanity
  • msfragala
  • adoprog
  • tonysanity
  • mrmrs
  • betson
  • georgedoescode
  • macdonst
  • eoinsanity
  • dashedstripes
  • jmswrnr
  • snocorp_sanity
  • mmgj
  • filmaj
  • samhem
  • gu-stav
  • patricksanity
  • mads.mogenshoj
  • sanitytom
  • sanity-cb
  • mm-sanity
  • sanitykev
  • victor.ayogu
  • ryanbethel_sanity
  • brianleroux
  • johnsicili