onStateChange([callback], [remove])

Class: Window.

Description:

Gets, registers or unregisters an event handler for when the state of the Window changes between normal, minimized, maximized.

Parameters:

Name Type Default Description

[callback]

function

The event handler function receiving WindowStateEvent event object.

[remove]

boolean

false

Set to true to unregister the event handler.

Returns:

Type: this

Examples:

// Example event object:
const e = {
  target: Window,            // The component that triggered the event.
  type: string,              // `change`
  fromState: Window.State,   // Previous state
  toState: Window.State,     // New state
  interactive: boolean       // Indicates if the state was changed by user's interaction with window
};

Also See: