0.0.1 • Published 2 years ago

cubby-db-js-sdk v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

CubbyDB JavaScript SDK

Official JavaScript SDK (browser and node) for interacting with the CubbyDB API.

Installation

Browser (manually via script tag)

<script src="/path/to/dist/cubbydb.umd.js"></script>

OR if you are using ES modules:

<script type="module">
    import CubbyDB from '/path/to/dist/cubbydb.es.mjs'
    ...
</script>

Node.js (via npm)

npm install cubbydb --save
// Using ES modules (default)
import CubbyDB from 'cubbydb'

// OR if you are using CommonJS modules
const CubbyDB = require('cubbydb/cjs')

🔧 For Node < 17 you'll need to load a fetch() polyfill. I recommend lquixada/cross-fetch:

// npm install cross-fetch --save
import 'cross-fetch/polyfill';

🔧 Node doesn't have native EventSource implementation, so in order to use the realtime subscriptions you'll need to load a EventSource polyfill.

// for server: npm install eventsource --save
import eventsource from 'eventsource';

// for React Native: npm install react-native-sse --save
import eventsource from "react-native-sse";

global.EventSource = eventsource;