-
Notifications
You must be signed in to change notification settings - Fork 6
/
mqtt-subscription-regestration-behaviour.html
52 lines (43 loc) · 1.32 KB
/
mqtt-subscription-regestration-behaviour.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<link rel="import" href="../polymer/polymer.html">
<!--
Enables a custom element to be included as an `mqtt-subscription` in an `mqtt-connection`.
-->
<script>
(function(scope) {
var MqttElements = scope.MqttElements = scope.MqttElements || {};
/**
@demo demo/index.html
@polymerBehavior
*/
MqttElements.MqttSubscriptionRegestrationBehaviour = {
properties: {
/**
* Fired when the element is added to an `mqtt-connection`.
*
* @event mqtt-subscription-register
*/
/**
* Fired when the element is removed from an `mqtt-connection`.
*
* @event 'mqtt-subscription-unregister
*/
/**
* The `mqtt-connection` that the element is registered to.
*/
_parentConnection: {
type: Object,
},
},
attached: function() {
// Note: the `mqtt-connection` that this element belongs to will set this
// element's _parentConnection property when handling this event.
this.fire('mqtt-subscription-register', {topic: this.topic, qos: this.qos});
},
detached: function() {
if (this._parentConnection) {
this._parentConnection.fire('mqtt-subscription-unregister', {target: this});
}
},
}
})(window)
</script>