You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Chore: Refactor Note.tsx and note-screen-shared.tsx to improve type safety (#9467)
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
export type OnNavigateCallback = ()=> Promise<boolean>;
|
||||
|
||||
export default class NavService {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
public static dispatch: Function = () => {};
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
private static handlers_: Function[] = [];
|
||||
private static handlers_: OnNavigateCallback[] = [];
|
||||
|
||||
public static async go(routeName: string) {
|
||||
if (this.handlers_.length) {
|
||||
@ -15,10 +16,11 @@ export default class NavService {
|
||||
type: 'NAV_GO',
|
||||
routeName: routeName,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
public static addHandler(handler: Function) {
|
||||
public static addHandler(handler: OnNavigateCallback) {
|
||||
for (let i = this.handlers_.length - 1; i >= 0; i--) {
|
||||
const h = this.handlers_[i];
|
||||
if (h === handler) return;
|
||||
@ -28,7 +30,7 @@ export default class NavService {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
public static removeHandler(hanlder: Function) {
|
||||
public static removeHandler(hanlder: OnNavigateCallback) {
|
||||
for (let i = this.handlers_.length - 1; i >= 0; i--) {
|
||||
const h = this.handlers_[i];
|
||||
if (h === hanlder) this.handlers_.splice(i, 1);
|
||||
|
Reference in New Issue
Block a user