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

abl-sdk-feathers

v0.10.25

Published

ABL SDK

Downloads

8

Readme

abl-sdk-feathers

  1. About
  2. Usage
  3. Developing

About

ABL's client-side API middleware based on the Feathers.js client. The following modules are included:

Usage

Reference the minified scripts in index.html:

<script src="node_modules/abl-sdk-feathers/dst/abl-sdk.vendor.min.js"></script>
<script src="node_modules/abl-sdk-feathers/dst/abl-sdk.min.js"></script>

Specify the abl-sdk-feathers module as a dependency of your AngularJS application:

var app = angular.module('abl', ['abl-sdk-feathers']);

Configure the $ablProvider service

app.config(function($ablProvider) {
    // Set the API endpoint for all requests
    $ablProvider.setEndpoint('https://api.ablist.win');
    //Set the API key to be added to REST headers for all outgoing requests
    $ablProvider.setApiKey('sk3$dlkj3Dljk3');
    // Use sockets with REST fallback
    $ablProvider.useSocket(false);
    // You can optionally provide additional opts for socket.io-client
    $ablProvider.setServices(['properties','units']);
});

AngularJS

Inject the $abl service into any controller, service or directive where you need it:

app.controller('SampleController', ["$scope", "$abl", function($scope, $abl) {
  // As a Promise
  var activities = $abl.services.activities.find({})
                    .then(function(res) { 
                      console.log(res);}
                    ); 
  // As an Observable
  var activities = $abl.services.activities.find({})
                    .subscribe(function(res) { 
                      console.log(res);}
                    )); 
}]);

React

The abl-sdk-feathers instance is accessible via the global variable $abl so usage is exactly the same:

function findActivities(query) {  
  // As a Promise
  $abl.services.activities.find(query)
    .then(function(res) { 
        return res;
      }
  ); 
  // As an Observable
  $abl.services.activities.find(query)
    .subscribe(function(res) { 
        return res;
      }
  )); 
}

Services

Services are the heart of every Feathers application and JavaScript objects (or instances of ES6 classes) that implements certain methods. Feathers itself will also add some additional methods and functionality to its services.

See the Feathers.js services documentation for more detail.

Service methods

Service methods are pre-defined CRUD methods that your service object can implement. Below is a complete example of the Feathers service interface:

const myService = {
  find(params) {},
  get(id, params) {},
  create(data, params) {},
  update(id, data, params) {},
  patch(id, data, params) {},
  remove(id, params) {},
  setup(app, path) {}
}

$abl.use('/my-service', myService);

Or as an ES6 class:

'use strict';

class MyService {
  find(params) {}
  get(id, params) {}
  create(data, params) {}
  update(id, data, params) {}
  patch(id, data, params) {}
  remove(id, params) {}
  setup(app, path) {}
}

$abl.use('/my-service', new MyService());

Querying

See the Feathers.js querying documentation for more detail.

// Find all unread messages in room #2
$abl.service('messages').find({
  query: {
    read: false,
    roomId: 2
  }
});
GET /messages?read=false&roomId=2

Utilities

$abl.showToast(message, cssClass, duration)

Launch an Angular Material toast with an optional CSS class and display duration:

$abl.showToast('Something OK happened. Nothing to see here!');
$abl.showToast('Error! You have been bad!', 'errorToast', 5000);

Developing

To work with the code, just run:

npm install && gulp

Build

gulp build