UNPKG

3.27 kBTypeScriptView Raw
1export declare class MenuController {
2 /**
3 * Programmatically open the Menu.
4 * @param [menuId] Optionally get the menu by its id, or side.
5 * @return returns a promise when the menu is fully opened
6 */
7 open(menuId?: string): Promise<boolean>;
8 /**
9 * Programmatically close the Menu. If no `menuId` is given as the first
10 * argument then it'll close any menu which is open. If a `menuId`
11 * is given then it'll close that exact menu.
12 * @param [menuId] Optionally get the menu by its id, or side.
13 * @return returns a promise when the menu is fully closed
14 */
15 close(menuId?: string): Promise<boolean>;
16 /**
17 * Toggle the menu. If it's closed, it will open, and if opened, it
18 * will close.
19 * @param [menuId] Optionally get the menu by its id, or side.
20 * @return returns a promise when the menu has been toggled
21 */
22 toggle(menuId?: string): Promise<boolean>;
23 /**
24 * Used to enable or disable a menu. For example, there could be multiple
25 * left menus, but only one of them should be able to be opened at the same
26 * time. If there are multiple menus on the same side, then enabling one menu
27 * will also automatically disable all the others that are on the same side.
28 * @param [menuId] Optionally get the menu by its id, or side.
29 * @return Returns the instance of the menu, which is useful for chaining.
30 */
31 enable(shouldEnable: boolean, menuId?: string): Promise<HTMLIonMenuElement>;
32 /**
33 * Used to enable or disable the ability to swipe open the menu.
34 * @param shouldEnable True if it should be swipe-able, false if not.
35 * @param [menuId] Optionally get the menu by its id, or side.
36 * @return Returns the instance of the menu, which is useful for chaining.
37 */
38 swipeGesture(shouldEnable: boolean, menuId?: string): Promise<HTMLIonMenuElement>;
39 /**
40 * @param [menuId] Optionally get the menu by its id, or side.
41 * @return Returns true if the specified menu is currently open, otherwise false.
42 * If the menuId is not specified, it returns true if ANY menu is currenly open.
43 */
44 isOpen(menuId?: string): Promise<boolean>;
45 /**
46 * @param [menuId] Optionally get the menu by its id, or side.
47 * @return Returns true if the menu is currently enabled, otherwise false.
48 */
49 isEnabled(menuId?: string): Promise<boolean>;
50 /**
51 * Used to get a menu instance. If a `menuId` is not provided then it'll
52 * return the first menu found. If a `menuId` is `left` or `right`, then
53 * it'll return the enabled menu on that side. Otherwise, if a `menuId` is
54 * provided, then it'll try to find the menu using the menu's `id`
55 * property. If a menu is not found then it'll return `null`.
56 * @param [menuId] Optionally get the menu by its id, or side.
57 * @return Returns the instance of the menu if found, otherwise `null`.
58 */
59 get(menuId?: string): Promise<HTMLIonMenuElement>;
60 /**
61 * @return Returns the instance of the menu already opened, otherwise `null`.
62 */
63 getOpen(): Promise<HTMLIonMenuElement>;
64 /**
65 * @return Returns an array of all menu instances.
66 */
67 getMenus(): Promise<HTMLIonMenuElement[]>;
68}