mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
refactor: improve hardware back button types (#28335)
Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> As part of FW-2832, the team would like to swap out usages of the `any` type for stronger types. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added `ionBackButton` event types to the browser utilities - Updated menuController to use the `doc` utility instead of `document` so we can get proper types - Moved the definitions for back button types out of `interface.d.ts` and into `hardware-back-button`. `interface.d.ts` still exports these back button interfaces. - Updated all `BackButtonEvent` imports inside of `@ionic/core` to import from the utility file instead of the public interface file. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Note: This PR was separated from other type updates associated with the FW-3832 work because I had to modify the implementation of a feature in Ionic. While I don't expect there to be any functional differences, I have opted to pull this work out into a separate branch and target a feature branch to a) reduce the impact of any unintended bugs and b) make it easier to do a `git bisect` if a bug is introduced.
This commit is contained in:
6
core/src/interface.d.ts
vendored
6
core/src/interface.d.ts
vendored
@ -32,6 +32,7 @@ export { TabsCustomEvent } from './components/tabs/tabs-interface';
|
||||
export { TextareaCustomEvent } from './components/textarea/textarea-interface';
|
||||
export { ToastOptions } from './components/toast/toast-interface';
|
||||
export { ToggleCustomEvent } from './components/toggle/toggle-interface';
|
||||
export { BackButtonEvent, BackButtonEventDetail } from './utils/hardware-back-button';
|
||||
|
||||
// Types from utils
|
||||
export {
|
||||
@ -140,17 +141,12 @@ export type ComponentRef = Function | HTMLElement | string | null;
|
||||
// eslint-disable-next-line
|
||||
export type ComponentProps<T = null> = { [key: string]: any };
|
||||
export type CssClassMap = { [className: string]: boolean };
|
||||
export type BackButtonEvent = CustomEvent<BackButtonEventDetail>;
|
||||
|
||||
export interface FrameworkDelegate {
|
||||
attachViewToDom(container: any, component: any, propsOrDataObj?: any, cssClasses?: string[]): Promise<HTMLElement>;
|
||||
removeViewFromDom(container: any, component: any): Promise<void>;
|
||||
}
|
||||
|
||||
export interface BackButtonEventDetail {
|
||||
register(priority: number, handler: (processNextHandler: () => void) => Promise<any> | void): void;
|
||||
}
|
||||
|
||||
export interface KeyboardEventDetail {
|
||||
keyboardHeight: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user