add fs and notifications to stdlib
This commit is contained in:
parent
f858daff59
commit
20f413508f
7 changed files with 163 additions and 35 deletions
15
runtime/index.d.ts
vendored
15
runtime/index.d.ts
vendored
|
@ -1,14 +1,25 @@
|
|||
declare global {
|
||||
interface Window {
|
||||
// internal
|
||||
__TIRAMISU_INTERNAL_invoke: (name: string, ...args: any[]) => Promise<any>;
|
||||
__TIRAMISU_INTERNAL_readFile: (path: string) => Promise<string>;
|
||||
__TIRAMISU_INTERNAL_readDir: (path: string) => Promise<string[]>;
|
||||
|
||||
// filesystem
|
||||
__TIRAMISU_FILESYSTEM_readFile: (path: string) => Promise<string>;
|
||||
__TIRAMISU_FILESYSTEM_readDir: (path: string) => Promise<string[]>;
|
||||
__TIRAMISU_INTERNAL_exists: (path: string) => Promise<boolean>;
|
||||
|
||||
// notifications
|
||||
__TIRAMISU_NOTIFICATIONS_notify: (message: string, ico?: string) => Promise<void>;
|
||||
|
||||
tiramisu: {
|
||||
invoke: (name: string, ...args: any[]) => Promise<any>;
|
||||
fs: {
|
||||
readFile(path: string): Promise<string>;
|
||||
readDir(path: string): Promise<string[]>;
|
||||
exists(path: string): Promise<boolean>;
|
||||
},
|
||||
notifications: {
|
||||
notify(message: string, ico?: string): Promise<void>;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
const tiramisu = {
|
||||
invoke: window.__TIRAMISU_INTERNAL_invoke,
|
||||
fs: {
|
||||
readFile: window.__TIRAMISU_INTERNAL_readFile,
|
||||
readDir: window.__TIRAMISU_INTERNAL_readDir
|
||||
}
|
||||
readFile: window.__TIRAMISU_FILESYSTEM_readFile,
|
||||
readDir: window.__TIRAMISU_FILESYSTEM_readDir,
|
||||
exists: window.__TIRAMISU_INTERNAL_exists,
|
||||
},
|
||||
notifications: {
|
||||
notify: window.__TIRAMISU_NOTIFICATIONS_notify,
|
||||
},
|
||||
}
|
||||
|
||||
window.tiramisu = tiramisu
|
Loading…
Add table
Add a link
Reference in a new issue