mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
chore(): migrate vue to typescript (#15928)
This commit is contained in:

committed by
Mike Hartington

parent
d800c48734
commit
e251ca71b4
57
vue/src/proxy-menu-controller.ts
Normal file
57
vue/src/proxy-menu-controller.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import * as apiUtils from './api-utils';
|
||||
import { ProxyMenuControllerInterface } from './interfaces';
|
||||
|
||||
// A proxy class that allows early access to controller methods
|
||||
export default class ProxyMenuController implements ProxyMenuControllerInterface {
|
||||
constructor(public tag: string) {}
|
||||
|
||||
// Open a menu
|
||||
open(menuId?: string): Promise<boolean> {
|
||||
return apiUtils.proxyMethod(this.tag, 'open', menuId);
|
||||
}
|
||||
|
||||
// Close a menu
|
||||
close(menuId?: string): Promise<boolean> {
|
||||
return apiUtils.proxyMethod(this.tag, 'close', menuId);
|
||||
}
|
||||
|
||||
// Toggle a menu
|
||||
toggle(menuId?: string): Promise<boolean> {
|
||||
return apiUtils.proxyMethod(this.tag, 'toggle', menuId);
|
||||
}
|
||||
|
||||
// Enable or disable a menu
|
||||
enable(shouldEnable: boolean, menuId?: string): Promise<HTMLElement> {
|
||||
return apiUtils.proxyMethod(this.tag, 'enable', shouldEnable, menuId);
|
||||
}
|
||||
|
||||
// Enable or disable the ability to swipe open the menu
|
||||
swipeEnable(shouldEnable: boolean, menuId?: string): Promise<HTMLElement> {
|
||||
return apiUtils.proxyMethod(this.tag, 'swipeEnable', shouldEnable, menuId);
|
||||
}
|
||||
|
||||
// Check if specific or any menu is open
|
||||
isOpen(menuId?: string): Promise<boolean> {
|
||||
return apiUtils.proxyMethod(this.tag, 'isOpen', menuId);
|
||||
}
|
||||
|
||||
// Check is certain menu is enabled
|
||||
isEnabled(menuId?: string): Promise<boolean> {
|
||||
return apiUtils.proxyMethod(this.tag, 'isEnabled', menuId);
|
||||
}
|
||||
|
||||
// Get specific or first menu instance
|
||||
get(menuId?: string): Promise<HTMLElement> {
|
||||
return apiUtils.proxyMethod(this.tag, 'get', menuId);
|
||||
}
|
||||
|
||||
// Get an instance of an open menu
|
||||
getOpen(): Promise<HTMLElement> {
|
||||
return apiUtils.proxyMethod(this.tag, 'getOpen');
|
||||
}
|
||||
|
||||
// Get an array of all menus
|
||||
getMenus(): Promise<HTMLElement> {
|
||||
return apiUtils.proxyMethod(this.tag, 'getMenus');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user