68 | | The new Inspector object classes should have the following format: |
| 68 | New Inspector object classes use ES6 class syntax and should have the following format: |
| 69 | |
| 70 | {{{ |
| 71 | WebInspector.NewObjectType = class NewObjectType extends WebInspector.Object { |
| 72 | constructor(param) |
| 73 | { |
| 74 | WebInspector.Object.call(this); |
| 75 | this._propertyName = param; |
| 76 | } |
| 77 | |
| 78 | // Public |
| 79 | |
| 80 | get propertyName() |
| 81 | { |
| 82 | return this._propertyName; |
| 83 | } |
| 84 | |
| 85 | set propertyName(value) |
| 86 | { |
| 87 | this._propertyName = value; |
| 88 | this.dispatchEventToListeners(WebInspector.NewObjectType.Event.PropertyWasChanged); |
| 89 | } |
| 90 | |
| 91 | publicMethod: function() |
| 92 | { |
| 93 | /* public methods called outside the class */ |
| 94 | } |
| 95 | |
| 96 | // Protected |
| 97 | |
| 98 | handleEvent: function(event) |
| 99 | { |
| 100 | /* delegate methods, event handlers, and overrides. */ |
| 101 | } |
| 102 | |
| 103 | // Private |
| 104 | |
| 105 | _privateMethod: function() |
| 106 | { |
| 107 | /* private methods are underscore prefixed */ |
| 108 | } |
| 109 | }; |
| 110 | |
| 111 | WebInspector.NewObjectType.Event = { |
| 112 | PropertyWasChanged: "new-object-type-property-was-changed" |
| 113 | }; |
| 114 | |
| 115 | }}} |
| 116 | |
| 117 | == Old class skeleton |
| 118 | |
| 119 | Some existing Inspector object classes have not been converted to ES6 classes. The should conform to the following format: |