2.0.1 • Published 9 months ago

@omneedia/client-js v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

client-js

An isomorphic JavaScript client for Omneedia.

Usage

First of all, you need to install the library:

npm install @omneedia/client-js

Then you're able to import the library and establish the connection with the database:

import { createClient } from '@omneedia/client-js'

// Create a single omneedia client for interacting with your database
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

UMD

You can now use plain <script>s to import client-js from CDNs, like:

<script src="https://cdn.jsdelivr.net/npm/@omneedia/client-js"></script>

or even:

<script src="https://unpkg.com/@omneedia/client-js"></script>

Then you can use it from a global omneedia variable:

<script>
  const { createClient } = omneedia
  const _omneedia = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

  console.log('Omneedia Instance: ', _omneedia)
  // ...
</script>

ESM

You can now use type="module" <script>s to import client-js from CDNs, like:

<script type="module">
  import { createClient } from 'https://cdn.jsdelivr.net/npm/@omneedia/client-js/+esm'
  const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

  console.log('Omneedia Instance: ', omneedia)
  // ...
</script>