Socket
Book a DemoInstallSign in
Socket

virgilio-on

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virgilio-on

Event-driven actions

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Virgilio-on

Event-driven actions for virgilio

Usage

Lets say we have a blinkLight and sendPush action on our Doorbell namespace.

var Doorbell = virgilio.namespace$('modules.doorbell');
Doorbell.defineAction$(function blinkLight() {
	console.log('Blink HUE light');
	// return Utils.hue.blink(...).then(func..{});
});
Doorbell.defineAction$(function sendPush() {
	console.log('Send RING RING push message');
	// return Utils.push.send(...).then(func..{});
});

We want these actions to run when a specific event is triggered, for example 'doorbell'. To make this happen we can assign an event to them.

Doorbell.blinkLight.on('doorbell');
Doorbell.sendPush.on('doorbell');

Now, when we send the 'doorbell' event the actions will run.

// Lets assume we have a virgilio instance
virgilio.emit('doorbell');

There is a working example of the above in the examples directory.

Keywords

virgilio

FAQs

Package last updated on 26 Apr 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