Add some missing methods to API docs.

This commit is contained in:
Don McCurdy 2017-12-24 00:03:52 -05:00
parent af282f908c
commit c83d4ce46a
2 changed files with 56 additions and 3 deletions

36
API.md
View File

@ -274,6 +274,10 @@ An "abstract" class that represents a given property of an object.
* [.domElement](#Controller+domElement) : <code>DOMElement</code>
* [.object](#Controller+object) : <code>Object</code>
* [.property](#Controller+property) : <code>String</code>
* [.options(options)](#Controller+options) ⇒ [<code>Controller</code>](#Controller)
* [.name(name)](#Controller+name) ⇒ [<code>Controller</code>](#Controller)
* [.listen()](#Controller+listen) ⇒ [<code>Controller</code>](#Controller)
* [.remove()](#Controller+remove) ⇒ [<code>Controller</code>](#Controller)
* [.onChange(fnc)](#Controller+onChange) ⇒ [<code>Controller</code>](#Controller)
* [.onFinishChange(fnc)](#Controller+onFinishChange) ⇒ [<code>Controller</code>](#Controller)
* [.setValue(newValue)](#Controller+setValue)
@ -308,6 +312,38 @@ The object to manipulate
The name of the property to manipulate
**Kind**: instance property of [<code>Controller</code>](#Controller)
<a name="Controller+options"></a>
### controller.options(options) ⇒ [<code>Controller</code>](#Controller)
**Kind**: instance method of [<code>Controller</code>](#Controller)
| Param | Type |
| --- | --- |
| options | <code>Array</code> \| <code>Object</code> |
<a name="Controller+name"></a>
### controller.name(name) ⇒ [<code>Controller</code>](#Controller)
Sets the name of the controller.
**Kind**: instance method of [<code>Controller</code>](#Controller)
| Param | Type |
| --- | --- |
| name | <code>string</code> |
<a name="Controller+listen"></a>
### controller.listen() ⇒ [<code>Controller</code>](#Controller)
Sets controller to listen for changes on its underlying object.
**Kind**: instance method of [<code>Controller</code>](#Controller)
<a name="Controller+remove"></a>
### controller.remove() ⇒ [<code>Controller</code>](#Controller)
Removes the controller from its parent GUI.
**Kind**: instance method of [<code>Controller</code>](#Controller)
<a name="Controller+onChange"></a>
### controller.onChange(fnc) ⇒ [<code>Controller</code>](#Controller)

View File

@ -883,7 +883,11 @@ function augmentController(gui, li, controller) {
controller.__li = li;
controller.__gui = gui;
common.extend(controller, {
common.extend(controller, /** @lends Controller.prototype */ {
/**
* @param {Array|Object} options
* @return {Controller}
*/
options: function(options) {
if (arguments.length > 1) {
const nextSibling = controller.__li.nextElementSibling;
@ -916,16 +920,29 @@ function augmentController(gui, li, controller) {
}
},
name: function(v) {
controller.__li.firstElementChild.firstElementChild.innerHTML = v;
/**
* Sets the name of the controller.
* @param {string} name
* @return {Controller}
*/
name: function(name) {
controller.__li.firstElementChild.firstElementChild.innerHTML = name;
return controller;
},
/**
* Sets controller to listen for changes on its underlying object.
* @return {Controller}
*/
listen: function() {
controller.__gui.listen(controller);
return controller;
},
/**
* Removes the controller from its parent GUI.
* @return {Controller}
*/
remove: function() {
controller.__gui.remove(controller);
return controller;