I've been looking over the GNOME shell javascript interface and noticed the following snippet (popupMenu.js for those who are interested) from the prototype of a class:
PopupSwitchMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function(text, active, params) {
... (code)
},
... function definitions
get state() {
return this._switch.state;
},
... more functions
};
Could anyone explain to me what the get state() { ... } means? I thought everything had to be of the form name: value within a javascript object? (If I make one of these objects I can do obj.state which returns what I assume is this._switch.state).
It may help to note that GNOME say they use a flavour of javascript (gjs) similar to Mozilla's Spidermonkey, so is this behaviour a non-standard javascript behaviour and a feature of spidermonkey/gjs?
Also, is there documentation pertaining to this?