Skip to content

Commit

Permalink
Add some missing methods to API docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Dec 24, 2017
1 parent af282f9 commit c83d4ce
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
36 changes: 36 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
23 changes: 20 additions & 3 deletions src/dat/gui/GUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c83d4ce

Please sign in to comment.