-
Notifications
You must be signed in to change notification settings - Fork 3
Coding standards
Wade Baglin edited this page Sep 3, 2016
·
8 revisions
Note: because a missing getter or setter doesn't throw an error, if you define a readonly or write-only property you should also throw an error for incorrect usage.
/**
* Defines a property to get a flag for whether the participant is connected or disconnected
* @readonly
* @throws on set value
* @return True when the participant is disconnected; else, false.
*/
Object.defineProperty(Participant.prototype, 'isDisconnected', {
get: function() {
return this._disconnected;
},
/* eslint-disable no-unused-vars */
set: function(val) {
/* eslint-enable no-unused-vars */
throw new Error('Property is readonly.');
}
});
/**
* Defines a property to get or set a flag for whether the participant is connected or disconnected
* @return True when the participant is disconnected; else, false.
*/
Object.defineProperty(Participant.prototype, 'isDisconnected', {
get: function() {
return this._disconnected;
},
/* eslint-disable no-unused-vars */
set: function(val) {
this._disconnected = val;
}
});
/**
* Defines a property to set a flag for whether the participant is connected or disconnected
* @throws on get value
*/
Object.defineProperty(Participant.prototype, 'isDisconnected', {
get: function() {
throw new Error('Property is write only.');
},
/* eslint-disable no-unused-vars */
set: function(val) {
this._disconnected = val;
}
});
[Developer environment setup](Developer environment setup)
[Coding standards](Coding standards)