New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

incusjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

incusjs

JavaScript bindings for talking to an [Incus](http://github.com/Imgur/incus) server in the browser or on the server-side.

latest
Source
npmnpm
Version
1.0.7
Version published
Weekly downloads
287
-38.01%
Maintainers
1
Weekly downloads
 
Created
Source

Incus.js Build Status NPM

JavaScript bindings for talking to an Incus server in the browser or on the server-side.

Example 1: Reacting to incoming events

var incus = new Incus.Client('http://localhost:4000', 'UID', '/page/path');

incus.on('connect', function() {
    console.log('connected');
}

incus.on('Event1', function (data) {
   console.log(data);
}

Example 2: Updating the page

Incus keeps track of which page a user is currently on, for the page message events. A page is just an arbitrary string. Use this to, for example, provide real-time updates only to users viewing particular content at a particular URL:

$(function() {
    incus.setPage(window.location.path);
});

Example 3: User messaging

Incus supports user-generated messages. You could use this to, for example, implement a simple chat system:

<div id="chat">
    <div id="messages"></div>
    
    <form id="input">
        <input type="text" class="input" placeholder="Say something." />
    </form>
</div>

$("#input form").on("submit", function(e) {
    e.preventDefault();
    
    incus.MessageAll("chatmessage", {
        "message": $("#chat .input").text()
    });
});

incus.on("chatmessage", function(msg) {
    $("#chat #messages").append($('<div>').text(msg.message));
});

Example 4: Browserify

Incus.js is distributed as a NPM module. If you already use node, using Incus is easy! Just add incusjs to your package.json and off you go:

{
    "dependencies": {
        "incusjs": "1.*"
    }
}
var IncusClient = require('incus');

var incus = new IncusClient('http://localhost:4000', 'UID', '/page/path');

incus.MessageUser('event1', 'uid1', {foo: 3});

FAQs

Package last updated on 04 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts