This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: filter templates jump from catalog list
- Loading branch information
Showing
5 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import mitt, { Handler } from 'mitt'; | ||
|
||
const emitter = mitt(); | ||
|
||
const key = Symbol('FILTER_CATALOG_LIST_KEY'); | ||
|
||
const key2 = Symbol('FILTER_TEMPLATE_LIST_KEY'); | ||
|
||
// trigger the event | ||
export function emitFilterCatalogAction(data: any) { | ||
emitter.emit(key, data); | ||
} | ||
|
||
export function listenFilterCatalogAction(handler: (data) => void) { | ||
emitter.on(key, handler as Handler); | ||
} | ||
|
||
export function removeFilterCatalogActionListener() { | ||
emitter.off(key); | ||
} | ||
|
||
// filter template | ||
export function emitFilterTemplateAction(data: any) { | ||
emitter.emit(key2, data); | ||
} | ||
|
||
export function listenFilterTemplateAction(handler: (data) => void) { | ||
emitter.on(key2, handler as Handler); | ||
} | ||
|
||
export function removeFilterTemplateActionListener() { | ||
emitter.off(key2); | ||
} | ||
|
||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters