npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fluidnotions/rx-pouch

v0.6.8

Published

Reactive PouchDB

Downloads

1

Readme

updated rxjs to 6.0.0

Under heavy development

You can use it, but stuff might still changes quickly, until we are at version 1.0.0

Docs

Read the official docs or look in the example directory.

Introduction

RxPouch is RxJS powered PouchDB, with some additional features, but still tried to provide all the same base functionallities. You can almost everywhere consult the PouchDB Docs for further information.

Installation

npm install rx-pouch --save
npm install rxjs --save

Difference to RxDB

Well a lot of credits goes to RxDB, since we borrowed a lot from them. In RxDB every collection creates a new database, which is in most use-cases perfectly fine. For my use-case it wasn't.

  • RxDB uses multiply databases, RxPouch uses document keys with the prefix <collection>- and adds to each document a property type: '<collection>'
  • RxDB has their own API
  • RxPouch tried to follow the official PouchDB API as close as possible, but also added some sugar.
  • RxPouch got less features (Leader Election, Schema, Population etc..)
  • RxPouch has a different filter / sorting system

Example usage

let RxPouch = require("rx-pouch");
let pouchLevelDB = require("pouchdb-adapter-leveldb");

process.on('unhandledRejection', (reason, promise) => {
    console.log('Unhandled Rejection at:', reason.stack || reason)
});


// add db adapter for nodejs
RxPouch.plugin(pouchLevelDB);

// create database
let db = new RxPouch('myDB');

// start listening for changes, enables all observers
let changes = db.changes();
changes.change$.subscribe(next => {
    console.log('change', next);
});

// create collection
let pokemons = db.collection('pokemon');

// listen for changes
pokemons.insert$.subscribe(next => {
    console.log('may display an notification that there is a new pokemon');
});

pokemons.remove$.subscribe(next => {
    console.log('may navigate away, from current pokemon page');
});

pokemons.docs$.subscribe(next => {
    console.log('may display an up to date list of all stored pokemons');
});

// create a doc
let pika = {
    _id: 'pikachu', // will result in pokemon-pikachu
    type: 'pokemon', // not needed, will be set anyway
    name: 'Pikachu',
    power: '120',
    element: 'power'
};

// insert data
pokemons.create(pika);