Home Reference Source
import {Button} from 'newton-lib/src/dom/dom.js'
public class | source

Button

Extends:

DOMElement → Button

Class used to handle a button (<button>).

Example:

// Given the following HTML button:
//   <button type="button" id="start"></button>
var start = new Button("start", function() {
 console.log("clicked");
});

Constructor Summary

Public Constructor
public

constructor(id: string, onClick: function)

Member Summary

Public Members
public

Callback function for when the button gets pressed.

Inherited Summary

From class DOMElement
public

Stores if the element is enabled or disabled.

public

jQuery reference to the element.

public

enabled(state: boolean)

Enable or disable the DOM element.

Public Constructors

public constructor(id: string, onClick: function) source

Override:

DOMElement#constructor

Params:

NameTypeAttributeDescription
id string

HTML id of the button.

onClick function

Callback function for when button is pressed.

Public Members

public onClick: function source

Callback function for when the button gets pressed.