Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Writing custom adapters

Nathan Vander Wilt edited this page · 6 revisions

[Background: I/@natevw am writing a new PouchDB adapter called PeerPouch, I'm starting this page as my notes along the way in the hopes it can be made more thorough in the future or at least help someone else get started quicker next time. Please don't consider it authoritative, I don't even know if the customApi is/will-ever-be considered stable…]

Writing a custom PouchDB adapter

Basic shape/registering it

TBD: basic notes on e.g. how to register and how/when adapter gets initialized, e.g https://github.com/natevw/PeerPouch/blob/master/pouch.webrtc.js#L12 and https://github.com/natevw/PeerPouch/blob/master/pouch.webrtc.js#L118

Required "class" methods

[preliminary]

  • destroy
  • valid

Required "instance" methods

[this list is basically copy-pasta grepping for "customApi." in https://github.com/daleharvey/pouchdb/blob/master/src/pouch.adapter.js right now]

  • bulkDocs
  • _getRevisionTree
  • _doCompaction
  • _get
  • _getAttachment
  • _allDocs
  • _changes
  • _close
  • _info
  • _id
  • _type [optional]
Something went wrong with that request. Please try again.