-
Notifications
You must be signed in to change notification settings - Fork 3
/
bridge.ts
34 lines (28 loc) · 876 Bytes
/
bridge.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import router from '@/router'
export type QObjectJSKeys = keyof typeof QObjectMap
export type SignalNames = keyof typeof signalCallbacks
// Map QObject name to JS side
export enum QObjectMap {
jsSideQObjectMappingKey = 'QT_SIDE_QOBJECT_KEY'
}
// We use only one object to store all pusher mapping from different QObject.
// interface PUSHER_MAP {
// [jsSideName: string]: qtSideName
// }
export enum PusherJSKeys {
jsSideMappingMethodName = 'QT_SIDE_METHOD_NAME'
}
export const dispatchersMap: { [key: string]: (payload: any) => any } = {
sampleActionFromCpp(payload: any) {
router.replace({
name: 'about',
query: Object.assign({}, payload)
})
}
}
// We use only one object to store all signal callbacks from different QObject.
export const signalCallbacks = {
onSignalMessagesFromQtSide(val: object) {
// do something you like
}
}