ion-menu-controller

Contents

Menu Controllerを使用すると、Menuを簡単に制御できます。提供されているメソッドは、Menuの表示、Menuの有効化、Menuの切り替えなどに使用できます。コントローラは、Menuへの参照を side か idで取得します。どちらも渡されない場合は、最初に見つかったMenuが取得されます。

メソッド

close

Description

Close the menu. If a menu is specified, it will close that menu. If no menu is specified, then it will close any menu that is open. If it does not find any open menus, it will return false.

Signatureclose(menu?: string | null | undefined) => Promise<boolean>

enable

Description

Enable or disable a menu. Disabling a menu will not allow gestures for that menu or any calls to open it. This is useful when there are multiple menus on the same side and only one of them should be allowed to open. Enabling a menu will automatically disable all other menus on that side.

Signatureenable(enable: boolean, menu?: string | null | undefined) => Promise<HTMLIonMenuElement | undefined>

get

Description

Get a menu instance. If a menu is not provided then it will return the first menu found. If the specified menu is start or end, then it will return the enabled menu on that side. Otherwise, it will try to find the menu using the menu's id property. If a menu is not found then it will return null.

Signatureget(menu?: string | null | undefined) => Promise<HTMLIonMenuElement | undefined>

getMenus

Description

Get all menu instances.

SignaturegetMenus() => Promise<HTMLIonMenuElement[]>

getOpen

Description

Get the instance of the opened menu. Returns null if a menu is not found.

SignaturegetOpen() => Promise<HTMLIonMenuElement | undefined>

isAnimating

Description

Get whether or not a menu is animating. Returns true if any menu is currently animating.

SignatureisAnimating() => Promise<boolean>

isEnabled

Description

Get whether or not the menu is enabled. Returns true if the specified menu is enabled. Returns false if a menu is disabled or not found.

SignatureisEnabled(menu?: string | null | undefined) => Promise<boolean>

isOpen

Description

Get whether or not the menu is open. Returns true if the specified menu is open. If a menu is not specified, it will return true if any menu is currently open.

SignatureisOpen(menu?: string | null | undefined) => Promise<boolean>

open

Description

Open the menu. If a menu is not provided then it will open the first menu found. If the specified menu is start or end, then it will open the enabled menu on that side. Otherwise, it will try to find the menu using the menu's id property. If a menu is not found then it will return false.

Signatureopen(menu?: string | null | undefined) => Promise<boolean>

registerAnimation

Description

Registers a new animation that can be used with any ion-menu by passing the name of the animation in its type property.

SignatureregisterAnimation(name: string, animation: AnimationBuilder) => Promise<void>

swipeGesture

Description

Enable or disable the ability to swipe open the menu.

SignatureswipeGesture(enable: boolean, menu?: string | null | undefined) => Promise<HTMLIonMenuElement | undefined>

toggle

Description

Toggle the menu open or closed. If the menu is already open, it will try to close the menu, otherwise it will try to open it. Returns false if a menu is not found.

Signaturetoggle(menu?: string | null | undefined) => Promise<boolean>