An open API service indexing awesome lists of open source software.

https://github.com/douganderson444/hyperbee-svelte-component

Hyperbee bundled into a Svelte Component for use in the browser or other bundlers
https://github.com/douganderson444/hyperbee-svelte-component

Last synced: 3 months ago
JSON representation

Hyperbee bundled into a Svelte Component for use in the browser or other bundlers

Awesome Lists containing this project

README

        

# hyperbee-svelte-component

Want to use hyperbee in the browser?

Hyperbee bundled into a Svelte Component for use in the browser or other bundlers

# Use

```html

import { onMount } from "svelte";
import HyperbeeComponent from "hyperbee-svelte-component";

let db
let opts = { keyEncoding: "utf-8", valueEncoding: "utf-8" };
let feed;
let display = true; // if you want to debug the component, default: false

onMount(async () => {
feed = store.get({ key }); // get a hypercore feed from a corestore or hyperspace instance
});

{#if feed}

{/if}

```

# Building

Run rollup to build the component

```
npm run build
```

Under the hood it bundles with browserify first (can't get rollup to do it right due to cjs?)

This bundles all the `require('hyperbee')` for you and rolls it into the component.