Skip to content

Commit c729a3e

Browse files
refactor: load onigasm (#193)
1 parent 7396785 commit c729a3e

File tree

4 files changed

+2
-35
lines changed

4 files changed

+2
-35
lines changed

src/main/services/ipc/fs.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/services/ipc/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { subscribeToContextMenu } from './context-menu'
22
import { subscribeToNotification } from './notifications'
33
import { subscribeToPrettier } from './prettier'
4-
import { subscribeToFs } from './fs'
54

65
export const subscribeToChannels = () => {
76
subscribeToContextMenu()
87
subscribeToNotification()
98
subscribeToPrettier()
10-
subscribeToFs()
119
}

src/renderer/App.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { useRoute } from 'vue-router'
4343
import type { Snippet } from '@shared/types/main/db'
4444
import { addDays, isSameDay, isYesterday } from 'date-fns'
4545
import { loadWASM } from 'onigasm'
46+
import onigasmFile from 'onigasm/lib/onigasm.wasm?url'
4647
import { loadGrammars } from '@/components/editor/grammars'
4748
4849
// По какой то причине необходимо явно установить роут в '/'
@@ -58,7 +59,7 @@ const isUpdateAvailable = ref(false)
5859
const isSupportToastShow = ref(false)
5960
6061
const init = async () => {
61-
await loadOnigasm()
62+
loadWASM(onigasmFile)
6263
await loadGrammars()
6364
6465
const theme = store.preferences.get('theme')
@@ -89,14 +90,6 @@ const init = async () => {
8990
checkForRemoteNotification()
9091
}
9192
92-
const loadOnigasm = async () => {
93-
const file = await ipc.invoke('main:fs-read', {
94-
path: '/onigasm/onigasm.wasm'
95-
})
96-
97-
loadWASM(new Uint8Array(file).buffer)
98-
}
99-
10093
const setTheme = (theme: string) => {
10194
document.body.dataset.theme = theme
10295
}

src/shared/types/main/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ type MainAction =
5252
| 'open-url'
5353
| 'prettier'
5454
| 'focus'
55-
| 'fs-read'
5655

5756
type ApiAction = 'snippet-create'
5857

0 commit comments

Comments
 (0)