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

wings-feathers

v4.0.10

Published

A FeathersJS 4-Way reactive data sync for any frontend framework

Downloads

49

Readme

Welcome to Wings-Feathers!

A FeathersJS 4-Way reactive data sync for any frontend framework

  • [x] DOM / UI (HTML)
  • [x] Data / State (Javascript)
  • [x] Local Storage (Offline)
  • [x] Backend/Database (Cloud)

Join and support our Community Web and Mobile Developers PH [ Facebook Page | Group ]

Installation

npm install wings-feathers

or

yarn add wings-feathers

Usage

import wings from 'wings-feathers'
// const wings = require('wings-feathers').default

let app = wings('http://localhost:3030')

let messagesSrvc = app.wingsService('messages')

messagesSrvc.on('dataChange', (messages) => {
  console.log(messages)
})

messagesSrvc.init()

app.wingsService(serviceName, params, config)

Returns a wingsService <object>

| Param| Type | Description | |--|--|--| | serviceName | <string> | Name of service | | params.query | <object> | ( Optional ) Refer to Feathers Querying | | config | <object> | ( Optional ) Configuration of wingsService <object> | | config.channels | <array> | ( Optional ) Array of channel objects |

params.query <object>

Refer to Feathers Querying

/* example records
  [
    { text: 'Hello', read: true, roomId: 1, nested: { prop: 'xander' } },
    { text: 'World', read: false, roomId: 2, nested: { prop: 'ford' } }
  ]
*/

let serviceName = 'message'

let params = {
  query: {
    read: false,
    roomId: 2
  }
}

let messagesSrvc = app.wingsService(serviceName, params)

messagesSrvc.on('dataChange', (messages) => {
  console.log(messages)
  // [ { text: 'World', read: false, roomId: 2, nested: { prop: 'ford' } } ]
})

config <object>

| Property | Type | Default | Description | |--|--|--|--| | debug | <boolean> | false | Logs all events init, created, removed, patched, updated, loadMore, reset | | newDataPosition | <string> | 'end' | Add new items to the start or end of an array | | paginate | <boolean> | false | Enable pagination based on $limit. **default is 10 records per page | | channels | <array> | [] | Refer to channels |

let config = {
  debug: true,
  newDataPosition: 'start',
  paginate: true,
  channels: []
} 

let messagesSrvc = app.wingsService(serviceName, params, config)

config.channels <array> and channel <object>

Channels determine which records to receive that passes the prop === value .

| Property | Type | Description | |--|--|--| | prop | <string> | Name of record's property | | value | <string | number | boolean | function> | Equality test value | | value | <function> | callback accepts (val, message) arguments for custom test. **Must return a boolean value |

/* example records
  [
    { text: 'Hello', read: true, roomId: 1, nested: { prop: 'xander' } },
    { text: 'World', read: false, roomId: 2, nested: { prop: 'ford' } }
  ]
*/

let config = {
  channels: [
    { prop: 'roomId', value: 2},
    { prop: 'nested.prop', value: 'ford'},
    { prop: 'nested', value: (val) => val.prop === 'ford' }
  ]
}

let messagesSrvc = app.wingsService(serviceName, params, config)

You may use dot notation in prop as reference into the object's property

reset(params, config)

set new params, config and triggers init method

let params = {
  query: {
    read: false,
    roomId: 2
  }
}

let config = {
  debug: true,
  newDataPosition: 'start',
  paginate: true,
  channels: []
}

messagesSrvc.reset(params, config)

loadMore()

loads more data based on $skip = ( page + 1 ) * $limit

messagesSrvc.loadMore()

loadAll()

loads all data based on ($skip = page * $limit) * pages

messagesSrvc.loadAll()

loadPage(page)

loads the based on $skip = page * $limit

messagesSrvc.loadPage(2)

destroy()

destroys all listners created by .on(eventName, listener) function

messagesSrvc.destroy()

Join and support our Community Web and Mobile Developers PH [ Facebook Page | Group ]