Dinh Long Nguyen a30eb7f968
feat: Jan Web (reusing Jan Desktop UI) (#6298)
* add platform guards

* add service management

* fix types

* move to zustand for servicehub

* update App Updater

* update tauri missing move

* update app updater

* refactor: move PlatformFeatures to separate const file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* change tauri fetch name

* update implementation

* update extension fetch

* make web version run properly

* disabled unused web settings

* fix all tests

* fix lint

* fix tests

* add mock for extension

* fix build

* update make and mise

* fix tsconfig for web-extensions

* fix loader type

* cleanup

* fix test

* update error handling + mcp should be working

* Update mcp init

* use separate is_web_app build property

* Remove fixed model catalog url

* fix additional tests

* fix download issue (event emitter not implemented correctly)

* Update Title html

* fix app logs

* update root tsx render timing

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-05 01:47:46 +07:00

30 lines
973 B
TypeScript

/**
* Tauri Events Service - Desktop implementation
*/
import { emit, listen } from '@tauri-apps/api/event'
import type { EventOptions, UnlistenFn } from './types'
import { DefaultEventsService } from './default'
export class TauriEventsService extends DefaultEventsService {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async emit<T>(event: string, payload?: T, _options?: EventOptions): Promise<void> {
try {
await emit(event, payload)
} catch (error) {
console.error('Error emitting Tauri event:', error)
throw error
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async listen<T>(event: string, handler: (event: { payload: T }) => void, _options?: EventOptions): Promise<UnlistenFn> {
try {
const unlisten = await listen<T>(event, handler)
return unlisten
} catch (error) {
console.error('Error listening to Tauri event:', error)
return () => {}
}
}
}