@talex-touch/utils 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animation/window-node.ts +15 -12
- package/animation/window.ts +19 -15
- package/auth/clerk-types.ts +1 -1
- package/auth/index.ts +1 -1
- package/auth/useAuthState.ts +6 -5
- package/auth/useClerkConfig.ts +4 -4
- package/auth/useClerkProvider.ts +3 -2
- package/channel/index.ts +23 -22
- package/common/file-scan-constants.ts +137 -121
- package/common/file-scan-utils.ts +48 -27
- package/common/index.ts +3 -3
- package/common/search/gather.ts +1 -1
- package/common/search/index.ts +5 -6
- package/common/storage/constants.ts +3 -2
- package/common/storage/entity/app-settings.ts +5 -3
- package/common/storage/entity/shortcut-settings.ts +10 -10
- package/common/storage/shortcut-storage.ts +6 -4
- package/common/utils/file.ts +14 -6
- package/common/utils/index.ts +62 -52
- package/common/utils/polling.ts +87 -84
- package/common/utils/task-queue.ts +11 -10
- package/common/utils/time.ts +50 -47
- package/common/utils/timing.ts +41 -37
- package/core-box/builder/index.ts +1 -1
- package/core-box/builder/tuff-builder.ts +254 -229
- package/core-box/index.ts +3 -6
- package/core-box/preview/index.ts +1 -0
- package/core-box/preview/types.ts +43 -0
- package/core-box/tuff/index.ts +1 -1
- package/core-box/tuff/tuff-dsl.ts +328 -266
- package/electron/clipboard-helper.ts +20 -12
- package/electron/download-manager.ts +43 -42
- package/electron/env-tool.ts +19 -18
- package/electron/file-parsers/index.ts +2 -2
- package/electron/file-parsers/parsers/text-parser.ts +15 -14
- package/electron/file-parsers/registry.ts +9 -7
- package/electron/file-parsers/types.ts +4 -4
- package/electron/index.ts +1 -1
- package/eventbus/index.ts +11 -11
- package/index.ts +5 -4
- package/intelligence/client.ts +87 -0
- package/intelligence/index.ts +1 -0
- package/package.json +14 -14
- package/permission/index.ts +8 -8
- package/plugin/channel.ts +77 -68
- package/plugin/index.ts +96 -82
- package/plugin/install.ts +8 -8
- package/plugin/log/types.ts +5 -5
- package/plugin/node/index.ts +1 -1
- package/plugin/node/logger-manager.ts +14 -11
- package/plugin/node/logger.ts +8 -8
- package/plugin/plugin-source.ts +11 -11
- package/plugin/preload.ts +1 -1
- package/plugin/providers/registry.ts +8 -7
- package/plugin/providers/types.ts +6 -6
- package/plugin/sdk/channel.ts +20 -20
- package/plugin/sdk/clipboard.ts +8 -6
- package/plugin/sdk/common.ts +10 -6
- package/plugin/sdk/core-box.ts +2 -3
- package/plugin/sdk/division-box.ts +266 -0
- package/plugin/sdk/enum/bridge-event.ts +1 -1
- package/plugin/sdk/examples/storage-onDidChange-example.js +1 -1
- package/plugin/sdk/features.ts +34 -26
- package/plugin/sdk/hooks/bridge.ts +3 -6
- package/plugin/sdk/hooks/index.ts +1 -1
- package/plugin/sdk/hooks/life-cycle.ts +4 -10
- package/plugin/sdk/index.ts +8 -7
- package/plugin/sdk/service/index.ts +3 -3
- package/plugin/sdk/storage.ts +4 -4
- package/plugin/sdk/system.ts +1 -1
- package/plugin/sdk/types.ts +147 -141
- package/plugin/sdk/window/index.ts +8 -5
- package/preload/loading.ts +6 -6
- package/preload/renderer.ts +4 -2
- package/renderer/hooks/arg-mapper.ts +1 -2
- package/renderer/hooks/index.ts +2 -0
- package/renderer/hooks/initialize.ts +10 -8
- package/renderer/hooks/performance.ts +4 -4
- package/renderer/hooks/use-channel.ts +150 -0
- package/renderer/hooks/use-intelligence.ts +236 -0
- package/renderer/index.ts +6 -2
- package/renderer/ref.ts +32 -36
- package/renderer/slots.ts +29 -26
- package/renderer/storage/app-settings.ts +16 -6
- package/renderer/storage/base-storage.ts +222 -114
- package/renderer/storage/index.ts +3 -0
- package/renderer/storage/intelligence-storage.ts +215 -0
- package/renderer/storage/openers.ts +13 -3
- package/renderer/touch-sdk/env.ts +41 -41
- package/renderer/touch-sdk/index.ts +1 -1
- package/renderer/touch-sdk/terminal.ts +5 -5
- package/renderer/touch-sdk/utils.ts +4 -3
- package/search/levenshtein-utils.ts +11 -11
- package/search/types.ts +102 -102
- package/service/index.ts +11 -11
- package/service/protocol/index.ts +217 -14
- package/types/division-box.ts +248 -0
- package/types/download.ts +72 -34
- package/types/index.ts +3 -1
- package/types/intelligence.ts +413 -0
- package/types/modules/base.ts +16 -16
- package/types/modules/index.ts +1 -1
- package/types/modules/module-lifecycle.ts +21 -21
- package/types/modules/module-manager.ts +11 -11
- package/types/modules/module.ts +16 -16
- package/types/storage.ts +0 -1
- package/types/touch-app-core.ts +32 -32
- package/types/update.ts +79 -21
- package/core-box/README.md +0 -218
- package/core-box/builder/tuff-builder.example.ts.bak +0 -258
- package/core-box/run-tests.sh +0 -7
- package/core-box/search.ts +0 -1
package/animation/window-node.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TalexTouch } from '../types'
|
|
1
|
+
import type { TalexTouch } from '../types'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Window animation controller return type
|
|
@@ -44,7 +44,7 @@ interface AnimationState {
|
|
|
44
44
|
* Simple easing function for smooth animation
|
|
45
45
|
*/
|
|
46
46
|
function easeInOutCubic(t: number): number {
|
|
47
|
-
return t < 0.5 ? 4 * t * t * t : 1 -
|
|
47
|
+
return t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -58,7 +58,7 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
58
58
|
|
|
59
59
|
const animationState: AnimationState = {
|
|
60
60
|
intervalId: null,
|
|
61
|
-
completed: false
|
|
61
|
+
completed: false,
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -67,9 +67,9 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
67
67
|
*/
|
|
68
68
|
const isWindowValid = (): boolean => {
|
|
69
69
|
return (
|
|
70
|
-
currentWindow !== null
|
|
71
|
-
currentWindow.window !== null
|
|
72
|
-
!currentWindow.window.isDestroyed()
|
|
70
|
+
currentWindow !== null
|
|
71
|
+
&& currentWindow.window !== null
|
|
72
|
+
&& !currentWindow.window.isDestroyed()
|
|
73
73
|
)
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -136,7 +136,8 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
136
136
|
}
|
|
137
137
|
}, 16) // ~60fps
|
|
138
138
|
})
|
|
139
|
-
}
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
140
141
|
console.error('Error in updateHeight:', error)
|
|
141
142
|
return Promise.resolve(false)
|
|
142
143
|
}
|
|
@@ -162,12 +163,14 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
162
163
|
if (targetVisible) {
|
|
163
164
|
// Show window
|
|
164
165
|
browserWindow.show()
|
|
165
|
-
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
166
168
|
// Hide window
|
|
167
169
|
if (process.platform === 'darwin') {
|
|
168
170
|
// On macOS, we can simply hide the window
|
|
169
171
|
browserWindow.hide()
|
|
170
|
-
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
171
174
|
// On other platforms, move window far off-screen before hiding
|
|
172
175
|
browserWindow.setPosition(-100000, -100000)
|
|
173
176
|
browserWindow.hide()
|
|
@@ -175,7 +178,8 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
return Promise.resolve(true)
|
|
178
|
-
}
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
179
183
|
console.error('Error in toggleWindow:', error)
|
|
180
184
|
return Promise.resolve(false)
|
|
181
185
|
}
|
|
@@ -196,7 +200,6 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
196
200
|
updateHeight,
|
|
197
201
|
cancel,
|
|
198
202
|
toggleWindow,
|
|
199
|
-
changeWindow
|
|
203
|
+
changeWindow,
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
|
-
|
package/animation/window.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { TalexTouch } from '../types'
|
|
1
2
|
import gsap from 'gsap'
|
|
2
|
-
import { TalexTouch } from '../types'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Window animation controller return type
|
|
@@ -52,7 +52,7 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
52
52
|
|
|
53
53
|
const animationState: AnimationState = {
|
|
54
54
|
tween: null,
|
|
55
|
-
completed: false
|
|
55
|
+
completed: false,
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -61,9 +61,9 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
61
61
|
*/
|
|
62
62
|
const isWindowValid = (): boolean => {
|
|
63
63
|
return (
|
|
64
|
-
currentWindow !== null
|
|
65
|
-
currentWindow.window !== null
|
|
66
|
-
!currentWindow.window.isDestroyed()
|
|
64
|
+
currentWindow !== null
|
|
65
|
+
&& currentWindow.window !== null
|
|
66
|
+
&& !currentWindow.window.isDestroyed()
|
|
67
67
|
)
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -97,13 +97,13 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
97
97
|
return new Promise<boolean>((resolve) => {
|
|
98
98
|
animationState.tween = gsap.to(
|
|
99
99
|
{
|
|
100
|
-
height: currentHeight
|
|
100
|
+
height: currentHeight,
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
height: newHeight,
|
|
104
104
|
duration,
|
|
105
105
|
ease: 'cubic-bezier(0.785, 0.135, 0.15, 0.86)',
|
|
106
|
-
onUpdate
|
|
106
|
+
onUpdate() {
|
|
107
107
|
// Check if animation was cancelled or window destroyed
|
|
108
108
|
if (!animationState.tween || !isWindowValid()) {
|
|
109
109
|
resolve(false)
|
|
@@ -122,11 +122,12 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
122
122
|
onKill: () => {
|
|
123
123
|
animationState.tween = null
|
|
124
124
|
resolve(false)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
127
|
)
|
|
128
128
|
})
|
|
129
|
-
}
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
130
131
|
console.error('Error in updateHeight:', error)
|
|
131
132
|
return Promise.resolve(false)
|
|
132
133
|
}
|
|
@@ -152,12 +153,14 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
152
153
|
if (targetVisible) {
|
|
153
154
|
// Show window
|
|
154
155
|
browserWindow.show()
|
|
155
|
-
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
156
158
|
// Hide window
|
|
157
159
|
if (process.platform === 'darwin') {
|
|
158
160
|
// On macOS, we can simply hide the window
|
|
159
161
|
browserWindow.hide()
|
|
160
|
-
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
161
164
|
// On other platforms, move window far off-screen before hiding
|
|
162
165
|
browserWindow.setPosition(-100000, -100000)
|
|
163
166
|
browserWindow.hide()
|
|
@@ -165,7 +168,8 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
return Promise.resolve(true)
|
|
168
|
-
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
169
173
|
console.error('Error in toggleWindow:', error)
|
|
170
174
|
return Promise.resolve(false)
|
|
171
175
|
}
|
|
@@ -186,6 +190,6 @@ export function useWindowAnimation(window?: TalexTouch.ITouchWindow): WindowAnim
|
|
|
186
190
|
updateHeight,
|
|
187
191
|
cancel,
|
|
188
192
|
toggleWindow,
|
|
189
|
-
changeWindow
|
|
193
|
+
changeWindow,
|
|
190
194
|
}
|
|
191
|
-
}
|
|
195
|
+
}
|
package/auth/clerk-types.ts
CHANGED
package/auth/index.ts
CHANGED
package/auth/useAuthState.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import type { ClerkAuthState, CurrentUser } from './clerk-types'
|
|
1
2
|
import { createGlobalState } from '@vueuse/core'
|
|
2
|
-
import {
|
|
3
|
-
import { ClerkAuthState, CurrentUser } from './clerk-types'
|
|
3
|
+
import { computed, shallowReactive } from 'vue'
|
|
4
4
|
|
|
5
5
|
export const useAuthState = createGlobalState(() => {
|
|
6
6
|
const authState = shallowReactive<ClerkAuthState>({
|
|
7
7
|
isLoaded: false,
|
|
8
8
|
isSignedIn: false,
|
|
9
9
|
user: null,
|
|
10
|
-
sessionId: null
|
|
10
|
+
sessionId: null,
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
return { authState }
|
|
@@ -25,7 +25,8 @@ export function useCurrentUser() {
|
|
|
25
25
|
let name = ''
|
|
26
26
|
if (firstName || lastName) {
|
|
27
27
|
name = [firstName, lastName].filter(Boolean).join(' ')
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
29
30
|
name = username || ''
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -36,7 +37,7 @@ export function useCurrentUser() {
|
|
|
36
37
|
name,
|
|
37
38
|
email,
|
|
38
39
|
avatar: imageUrl,
|
|
39
|
-
provider: 'clerk'
|
|
40
|
+
provider: 'clerk',
|
|
40
41
|
}
|
|
41
42
|
})
|
|
42
43
|
|
package/auth/useClerkConfig.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClerkConfig } from
|
|
1
|
+
import type { ClerkConfig } from './clerk-types'
|
|
2
2
|
|
|
3
3
|
const clerkPublishableKey = (import.meta.env as any).VITE_CLERK_PUBLISHABLE_KEY
|
|
4
4
|
const clerkDomain = (import.meta.env as any).VITE_CLERK_DOMAIN
|
|
@@ -15,7 +15,7 @@ export const defaultClerkConfig: ClerkConfig = {
|
|
|
15
15
|
signInUrl: '/sign-in',
|
|
16
16
|
signUpUrl: '/sign-up',
|
|
17
17
|
afterSignInUrl: '/home',
|
|
18
|
-
afterSignUpUrl: '/home'
|
|
18
|
+
afterSignUpUrl: '/home',
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function useClerkConfig() {
|
|
@@ -23,7 +23,7 @@ export function useClerkConfig() {
|
|
|
23
23
|
return {
|
|
24
24
|
...defaultClerkConfig,
|
|
25
25
|
publishableKey:
|
|
26
|
-
localStorage.getItem(CLERK_PUBLISHABLE_KEY_KEY) || defaultClerkConfig.publishableKey
|
|
26
|
+
localStorage.getItem(CLERK_PUBLISHABLE_KEY_KEY) || defaultClerkConfig.publishableKey,
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,6 +35,6 @@ export function useClerkConfig() {
|
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
37
|
getClerkConfig,
|
|
38
|
-
setClerkConfig
|
|
38
|
+
setClerkConfig,
|
|
39
39
|
}
|
|
40
40
|
}
|
package/auth/useClerkProvider.ts
CHANGED
|
@@ -22,7 +22,8 @@ export function useClerkProvider() {
|
|
|
22
22
|
|
|
23
23
|
console.log('Clerk initialized successfully')
|
|
24
24
|
return clerkInstance
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
26
27
|
console.error('Failed to initialize Clerk:', error)
|
|
27
28
|
throw error
|
|
28
29
|
}
|
|
@@ -46,6 +47,6 @@ export function useClerkProvider() {
|
|
|
46
47
|
initializeClerk,
|
|
47
48
|
getClerk,
|
|
48
49
|
isClerkInitialized,
|
|
49
|
-
cleanupClerk
|
|
50
|
+
cleanupClerk,
|
|
50
51
|
}
|
|
51
52
|
}
|
package/channel/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export enum ChannelType {
|
|
2
|
-
MAIN =
|
|
3
|
-
PLUGIN =
|
|
2
|
+
MAIN = 'main',
|
|
3
|
+
PLUGIN = 'plugin',
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export enum DataCode {
|
|
7
7
|
SUCCESS = 200,
|
|
8
8
|
NETWORK_ERROR = 500,
|
|
9
|
-
ERROR = 100
|
|
9
|
+
ERROR = 100,
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export type ChannelCallback = (data: StandardChannelData) => any
|
|
@@ -20,7 +20,7 @@ export interface ITouchChannel {
|
|
|
20
20
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
21
21
|
* @param callback {Function} The callback function
|
|
22
22
|
*/
|
|
23
|
-
regChannel(type: ChannelType, eventName: string, callback: ChannelCallback)
|
|
23
|
+
regChannel: (type: ChannelType, eventName: string, callback: ChannelCallback) => () => void
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Unregister a channel
|
|
@@ -30,7 +30,7 @@ export interface ITouchChannel {
|
|
|
30
30
|
* @param callback {Function} The callback function to unregister
|
|
31
31
|
* @returns {boolean} Returns true if the channel was successfully unregistered, false otherwise
|
|
32
32
|
*/
|
|
33
|
-
unregChannel(type: ChannelType, eventName: string, callback: ChannelCallback)
|
|
33
|
+
unregChannel: (type: ChannelType, eventName: string, callback: ChannelCallback) => boolean
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @deprecated Use sendMain instead
|
|
@@ -39,7 +39,7 @@ export interface ITouchChannel {
|
|
|
39
39
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
40
40
|
* @param arg {any} The arguments of the message
|
|
41
41
|
*/
|
|
42
|
-
send(type: ChannelType, eventName: string, arg?: any)
|
|
42
|
+
send: (type: ChannelType, eventName: string, arg?: any) => Promise<any>
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @deprecated Use sendToMain instead
|
|
@@ -49,14 +49,14 @@ export interface ITouchChannel {
|
|
|
49
49
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
50
50
|
* @param arg {any} The arguments of the message
|
|
51
51
|
*/
|
|
52
|
-
sendTo(win: Electron.BrowserWindow, type: ChannelType, eventName: string, arg: any)
|
|
52
|
+
sendTo: (win: Electron.BrowserWindow, type: ChannelType, eventName: string, arg: any) => Promise<any>
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Send a message to main process
|
|
56
56
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
57
57
|
* @param arg {any} The arguments of the message
|
|
58
58
|
*/
|
|
59
|
-
sendMain(eventName: string, arg?: any)
|
|
59
|
+
sendMain: (eventName: string, arg?: any) => Promise<any>
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Send a message to main process with settled window
|
|
@@ -64,14 +64,14 @@ export interface ITouchChannel {
|
|
|
64
64
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
65
65
|
* @param arg {any} The arguments of the message
|
|
66
66
|
*/
|
|
67
|
-
sendToMain(win: Electron.BrowserWindow, eventName: string, arg?: any)
|
|
67
|
+
sendToMain: (win: Electron.BrowserWindow, eventName: string, arg?: any) => Promise<any>
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Send a message to all plugin process with settled window
|
|
71
71
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
72
72
|
* @param arg {any} The arguments of the message
|
|
73
73
|
*/
|
|
74
|
-
sendPlugin(pluginName: string, eventName: string, arg?: any)
|
|
74
|
+
sendPlugin: (pluginName: string, eventName: string, arg?: any) => Promise<any>
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Send a message to plugin process with settled window
|
|
@@ -79,7 +79,7 @@ export interface ITouchChannel {
|
|
|
79
79
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
80
80
|
* @param arg {any} The arguments of the message
|
|
81
81
|
*/
|
|
82
|
-
sendToPlugin(pluginName: string, eventName: string, arg?: any)
|
|
82
|
+
sendToPlugin: (pluginName: string, eventName: string, arg?: any) => Promise<any>
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Request a encrypted name key. This key cannot decrypted to get the original name.
|
|
@@ -106,7 +106,7 @@ export interface ITouchClientChannel {
|
|
|
106
106
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType
|
|
107
107
|
* @param callback {Function} The callback function
|
|
108
108
|
*/
|
|
109
|
-
regChannel(eventName: string, callback: (data: StandardChannelData) => any)
|
|
109
|
+
regChannel: (eventName: string, callback: (data: StandardChannelData) => any) => () => void
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Unregister a channel
|
|
@@ -115,21 +115,21 @@ export interface ITouchClientChannel {
|
|
|
115
115
|
* @param callback {Function} The callback function to unregister
|
|
116
116
|
* @returns {boolean} Returns true if the channel was successfully unregistered, false otherwise
|
|
117
117
|
*/
|
|
118
|
-
unRegChannel(eventName: string, callback: (data: StandardChannelData) => any)
|
|
118
|
+
unRegChannel: (eventName: string, callback: (data: StandardChannelData) => any) => boolean
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Send a message to a channel
|
|
122
122
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
123
123
|
* @param arg {any} The arguments of the message
|
|
124
124
|
*/
|
|
125
|
-
send(eventName: string, arg?: any)
|
|
125
|
+
send: (eventName: string, arg?: any) => Promise<any>
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
* Send a message to a channel and get the response
|
|
129
129
|
* @param eventName {string} The name of event, must be unique in the channel {@link ChannelType}
|
|
130
130
|
* @param arg {any} The arguments of the message
|
|
131
131
|
*/
|
|
132
|
-
sendSync(eventName: string, arg?: any)
|
|
132
|
+
sendSync: (eventName: string, arg?: any) => any
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
export interface RawChannelSyncData {
|
|
@@ -149,11 +149,12 @@ export interface RawChannelSyncData {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export interface RawChannelHeaderData {
|
|
152
|
-
status:
|
|
153
|
-
type: ChannelType
|
|
154
|
-
_originData?: any
|
|
152
|
+
status: 'reply' | 'request'
|
|
153
|
+
type: ChannelType
|
|
154
|
+
_originData?: any
|
|
155
155
|
uniqueKey?: string
|
|
156
|
-
event?: Electron.IpcMainEvent | Electron.IpcRendererEvent
|
|
156
|
+
event?: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent | Electron.IpcRendererEvent
|
|
157
|
+
plugin?: string
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
export interface RawChannelData {
|
|
@@ -172,12 +173,12 @@ export interface StandardChannelData extends RawStandardChannelData {
|
|
|
172
173
|
reply: (code: DataCode, data: IChannelData) => void
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
export type IChannelData = any //boolean | number | string | null | undefined | {
|
|
176
|
-
|
|
176
|
+
export type IChannelData = any // boolean | number | string | null | undefined | {
|
|
177
|
+
// [prop: string]: any
|
|
177
178
|
// }
|
|
178
179
|
|
|
179
180
|
// Default export for Vite compatibility (only values, not types)
|
|
180
181
|
export default {
|
|
181
182
|
ChannelType,
|
|
182
|
-
DataCode
|
|
183
|
+
DataCode,
|
|
183
184
|
}
|