new Input
Helper class for binding HTML input to an ol.Object
Example:
// bind a checkbox with id 'visible' to a layer's visibility
var visible = new ol.dom.Input(document.getElementById('visible'));
visible.bindTo('checked', layer, 'visible');
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Element | Target element. |
- Source:
- input.js, line 33
Extends
Methods
-
bindTo
-
Binds a View to a Model.
Parameters:
Name Type Argument Description keystring Key.
targetol.Object Target.
targetKeystring <optional>
(Optional) Target key.
noNotifyboolean <optional>
(Optional) No notify.
- Inherited From:
- Source:
- object.js, line 147
-
get
-
Gets a value.
Parameters:
Name Type Description keystring Key.
- Inherited From:
- Source:
- object.js, line 170
Returns:
Value.
- Type
- *
-
getChecked
-
If the input is a checkbox, return whether or not the checbox is checked.
- Source:
- input.js, line 62
Returns:
checked.
- Type
- boolean | undefined
-
getValue
-
Get the value of the input.
- Source:
- input.js, line 75
Returns:
input value.
- Type
- string | undefined
-
getValueAsNumber
-
Get the value of the input as a number.
- Source:
- input.js, line 88
Returns:
input value as number.
- Type
- number | null | undefined
-
notify
-
Notify all observers of a change on this property. This notifies both objects that are bound to the object's property as well as the object that it is bound to.
Parameters:
Name Type Description keystring Key.
- Inherited From:
- Source:
- object.js, line 208
-
on
-
Listen for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerFunction The listener function.
scopeObject <optional>
(Optional) Object is whose scope to call the listener.
- Inherited From:
- Source:
- object.js, line 240
Returns:
Unique key for the listener.
- Type
- goog.events.Key
-
once
-
Listen once for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerFunction The listener function.
scopeObject <optional>
(Optional) Object is whose scope to call the listener.
- Inherited From:
- Source:
- object.js, line 253
Returns:
Unique key for the listener.
- Type
- goog.events.Key
-
set
-
Sets a value.
Parameters:
Name Type Description keystring Key.
value* Value.
- Inherited From:
- Source:
- object.js, line 263
-
setChecked
-
Set whether or not a checkbox is checked.
Parameters:
Name Type Description checkedboolean Checked.
- Source:
- input.js, line 127
-
setValue
-
Sets the value of the input.
Parameters:
Name Type Description valuestring Value.
- Source:
- input.js, line 101
-
setValueAsNumber
-
Sets the number value of the input.
Parameters:
Name Type Description valuenumber Number value.
- Source:
- input.js, line 114
-
setValues
-
Sets a collection of key-value pairs.
Parameters:
Name Type Description valuesObject.<string, *> Values.
- Inherited From:
- Source:
- object.js, line 286
-
un
-
Unlisten for a certain type of event.
Parameters:
Name Type Argument Description typestring | Array.<string> The event type or array of event types.
listenerFunction The listener function.
scopeObject <optional>
(Optional) Object is whose scope to call the listener.
- Inherited From:
- Source:
- object.js, line 326
-
unbind
-
Removes a binding. Unbinding will set the unbound property to the current value. The object will not be notified, as the value has not changed.
Parameters:
Name Type Description keystring Key.
- Inherited From:
- Source:
- object.js, line 305
-
unbindAll
-
Removes all bindings.
- Inherited From:
- Source:
- object.js, line 344
-
unByKey
-
Removes an event listener which was added with listen() by the key returned by on().
Parameters:
Name Type Argument Description keynumber <nullable>
Key.
- Inherited From:
- Source:
- object.js, line 336