mixins/bussable

Description

Provides easy access to the system bus and provides some helper methods for doing so

Details

Members


<private> _subscriptions :Array

Description

The list of subscriptions maintained by the mixin

Details
Array

Methods


subscribe( channel, topic [, callback ] ) → {object}

Description

Subscribe to an event

Parameters
Name Type Attributes Description
channel string

The channel to subscribe to

topic string

The topic to subscribe to

callback callback <optional>

What to do when you get the event

Returns

The subscription definition

Details

once( channel [, topic [, callback ] ] ) → {object}

Description

Subscribe to an event once

Parameters
Name Type Attributes Description
channel string

The channel to subscribe to

topic string <optional>

The topic to subscribe to

callback callback <optional>

What to do when you get the event

Returns

The subscription definition

Details

publish( [ channel [, topic [, options ] ] ] )

Description

Publish an event on the system bus

Parameters
Name Type Attributes Default Description
channel string <optional>
'2'

The channel to publish to

topic string <optional>
1

The topic to publish to

options object <optional>
{}

What to pass to the event

Name Type Attributes Default Description
ha boolean <optional>
2

Test sub prop

Details

getSubscription( channel, topic ) → {object}

Description

Get a subscription definition

Parameters
Name Type Description
channel string
topic string
Returns

The subscription definition

Details

<private> destroy()

Description

Gets rid of all subscriptions for this object.

Details