0.1.2 • Published 8 years ago

booleans-io v0.1.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
8 years ago

Booleans.io

The booleans.io client uses web sockets to push boolean changes to your application in real-time.

This product is in beta, and feedback is welcome. Contact us at hello@booleans.io.

Install

Node.js

npm install booleans-io

Web

Download the JS client bundle (with Socket.io) or standalone (without Socket.io). Add it to your web app via script tag.

<script type="text/javascript" src="/js/vendor/booleans.io.min.js"></script>

If you use the standalone library, you'll need to load Socket.io yourself, before Booleans.io.

Usage

Create an account and create an access token on the Accounts page.

Create a custom boolean and give it a label like 'signedIn'. You'll use this label as a reference in your code.

// Node.js only
var booleans = require('booleans-io');

// Initialize with your token
booleans.init(yourToken, function(data) {
  console.log(data) // Array of your booleans
  
  // Get a boolean by ID
  var signedIn = booleans.get(ID).val; // false

  // Get a boolean by label
  signedIn = booleans.get('signedIn').val; // false

  // Get notified on change
  booleans.get('signedIn').on('update', function(val) {
    console.log(val); // true
  }

  // List all booleans
  booleans.list(); // Array of booleans

}
0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago