JS library for interacting with the Climb.social API.
Provides an RxJS Observable of pages of approved items for use in JS applications.
Looking for simple HTML embed code? Try the react-climb-social. There's also angular-climb and a simple JSONP REST API for you to choose from.
The default exports of the module exposes a getStream
method that accepts a collectionId
which you can subscribe to.
npm install climb-social --save-dev
Make sure you've got a Climb.social account, you've made a new collection and you've approved some content.
Then note down your collectionId
.
var climb = require('climb-social');
var collectionId = '561ba63445284e1740e016f7';
climb
.getStream(collectionId)
.subscribe(function(items) {
// i.e. Do something with items:
items.map(function(item) {
console.log(item.author.username);
});
});
You can also specify how often you'd like to poll the Climb.social API for changes.
Pass a positive number (representing the number of seconds) as a second arg to getStream()
:
climb
.getStream(collectionId, 40)
.subscribe(function(items) {
...
});
});