js-lib2
This is the Official Stackable API Javascript library for getting data from stacks.
Last updated 3 years ago by perminder-klair .
ISC · Original npm · Tarball · package.json
$ cnpm install js-lib2 
SYNC missed versions from official npm registry.

Stackable Javascript Library

This is the Official Stackable API Javascript library for getting data from stacks.

Available and Support in both Browser and NodeJs.

Working examples are found in examples directory!

In browser jQuery is required.

Install

You can get it on npm

npm install stackable --save

Or bower, too.

bower install stackable --save

Include Stackable file in your project

<script src="dist/stackable.min.js"></script>

Usage

Make sure to create an account at http://www.stackable.space and setup your Stack and Containers.

To initialize

var stackable = new Stackable('YOUR-STACK-PUBLIC-KEY-HERE');

To list all containers

stackable.getContainers(function (error, result) {
    console.log(error, result);
});

To get single containers

stackable.getContainer('CONTAINER-ID-HERE', function (error, result) {
    console.log(error, result);
});

To get all items within single container

stackable.getContainerItems('CONTAINER-ID-HERE', function (error, result) {
    console.log(error, result);
});

To get all items within stack

stackable.getAllItems(function (error, result) {
    console.log(error, result);
});

To get single item

stackable.getItem('ITEM-ID-HERE', function (error, result) {
    console.log(error, result);
});

To create new item

  • First initialize, using PRIVATE KEY, (MAKE SURE YOU KEEP THIS KEY SAFE! MOSTLY ON SERVER SIDE)
var stackable = new Stackable('YOUR-STACK-PRIVATE-KEY-HERE');
var dataToPost = {
    name: 'John Doe',
    age: 29
};

stackable.createItem('CONTAINER-ID-HERE', dataToPost, function (error, result) {
    console.log(error, result);
});

To update an item

var dataToUpdate = {
    name: 'John Doe',
    age: 29
};

stackable.updateItem('ITEM-ID-HERE', dataToUpdate, function (error, result) {
    console.log(error, result);
});

To build (development)

Sources files are located in src directory

Run npm install to setup required libraries.

npm install

npm Scripts

  • npm test - Lint the library and tests, then run the unit tests
  • npm run lint - Lint the source and unit tests
  • npm run watch - Continuously run the unit tests as you make changes to the source and test files themselves
  • npm run test-browser - Build the library for use with the browser spec runner. Changes to the source will cause the runner to automatically refresh.
  • npm run build - Lint then build the library
  • npm run coverage - Generate a coverage report

Todo

  • Write tests.
  • Test with Nodejs App
  • Nodejs example

Current Tags

  • 1.1.0                                ...           latest (3 years ago)

1 Versions

  • 1.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 0
Dependencies (1)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |