Class AppBar

Represents an application toolbar for displaying commands.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(element?: HTMLElement, options?: any): AppBar

Creates a new AppBar object.

constructor

Parameters

  • element?: HTMLElement optional

    The DOM element that will host the control.

  • options?: any optional

    The set of properties and values to apply to the new AppBar.

Returns

AppBar

Properties

public commands: AppBarCommand[]

Sets the AppBarCommand objects that appear in the app bar.

public disabled: boolean

Gets or sets a value that indicates whether the AppBar is disabled.

public element: HTMLElement

Gets the DOM element that hosts the AppBar.

public hidden: boolean

Gets a value that indicates whether the AppBar is hidden or in the process of becoming hidden.

public layout: string

Gets or sets the layout of the app bar contents.

public placement: string

Gets or sets a value that specifies whether the AppBar appears at the top or bottom of the main view.

public sticky: boolean

Gets or sets a value that indicates whether the AppBar is sticky (won't light dismiss). If not sticky, the app bar dismisses normally when the user touches outside of the appbar.

Methods

public addEventListener(type: string, listener: Function, useCapture?: boolean)

Registers an event handler for the specified event.

Parameters

  • type: string

    The event type to register. It must be beforeshow, beforehide, aftershow, or afterhide.

  • listener: Function

    The event handler function to associate with the event.

  • useCapture?: boolean optional

    Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase.

public dispatchEvent(type: string, eventProperties: any): boolean

Raises an event of the specified type and with additional properties.

Parameters

  • type: string

    The type (name) of the event.

  • eventProperties: any

    The set of additional properties to be attached to the event object when the event is raised.

Returns

boolean

true if preventDefault was called on the event, otherwise false.

public dispose()

Releases resources held by this AppBar. Call this method when the AppBar is no longer needed. After calling this method, the AppBar becomes unusable.

public getCommandById(id: string): AppBarCommand

Returns the AppBarCommand object identified by id.

Parameters

  • id: string

    The element idenitifier (ID) of the command to be returned.

Returns

AppBarCommand

The command identified by id. If multiple commands have the same ID, returns an array of all the commands matching the ID.

public hide()

Hides the AppBar.

public hideCommands(commands: Array<any>, immediate?: boolean)

Hides the specified commands of the AppBar.

Parameters

  • commands: Array<any>

    The commands to hide. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands.

  • immediate?: boolean optional

    The parameter immediate is not supported and may be altered or unavailable in the future. true to hide the commands immediately, without animating them; otherwise, false.

public onafterhide(eventInfo: Event)

Occurs immediately after the AppBar is hidden.

Parameters

  • eventInfo: Event

    An object that contains information about the event.

public onaftershow(eventInfo: Event)

Occurs after the AppBar is shown.

Parameters

  • eventInfo: Event

    An object that contains information about the event.

public onbeforehide(eventInfo: Event)

Occurs before the AppBar is hidden.

Parameters

  • eventInfo: Event

    An object that contains information about the event.

public onbeforeshow(eventInfo: Event)

Occurs before a hidden AppBar is shown.

Parameters

  • eventInfo: Event

    An object that contains information about the event.

public removeEventListener(type: string, listener: Function, useCapture?: boolean)

Removes an event handler that the addEventListener method registered.

Parameters

  • type: string

    The event type to unregister. It must be beforeshow, beforehide, aftershow, or afterhide.

  • listener: Function

    The event handler function to remove.

  • useCapture?: boolean optional

    Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler.

public show()

Shows the AppBar if it is not disabled.

public showCommands(commands: Array<any>, immediate?: boolean)

Shows the specified commands of the AppBar.

Parameters

  • commands: Array<any>

    The commands to show. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands.

  • immediate?: boolean optional

    The parameter immediate is not supported and may be altered or unavailable in the future. true to show the commands immediately, without animating them; otherwise, false.

public showOnlyCommands(commands: Array<any>, immediate?: boolean)

Shows the specified commands of the AppBar while hiding all other commands.

Parameters

  • commands: Array<any>

    The commands to show. The array elements may be AppBarCommand objects, or the string identifiers (IDs) of commands.

  • immediate?: boolean optional

    The parameter immediate is not supported and may be altered or unavailable in the future. true to show the specified commands (and hide the others) immediately, without animating them; otherwise, false.