Skip to content

PushButtonModel

Overview

Basic model for a push button, including over/down/enabled properties.

@author Sam Reid (PhET Interactive Simulations) @author John Blanco (PhET Interactive Simulations) @author Chris Malley (PixelZoom, Inc.)

Class PushButtonModel

import { PushButtonModel } from 'scenerystack/sun';

Constructor

new PushButtonModel( providedOptions? : PushButtonModelOptions )

Instance Methods

dispose()

addListener( listener : PushButtonListener )

Adds a listener. If already a listener, this is a no-op. @param listener - function called when the button is pressed, no args

removeListener( listener : PushButtonListener )

Removes a listener. If not a listener, this is a no-op.

fire()

Fires all listeners. Public for phet-io and a11y use.

Instance Properties

isFiringProperty : Property<boolean>

(readonly)

used by ResetAllButton to call functions during reset start/end

Type PushButtonListener

import type { PushButtonListener } from 'scenerystack/sun';

() => void

Type PushButtonModelOptions

import type { PushButtonModelOptions } from 'scenerystack/sun';

Source Code

See the source for PushButtonModel.ts in the sun repository.