diff --git a/runtime/js/runtime/events.js b/runtime/js/runtime/events.js index ba3bbf13..9ba4ffd8 100644 --- a/runtime/js/runtime/events.js +++ b/runtime/js/runtime/events.js @@ -61,9 +61,9 @@ function Emit(eventName) { * the event is acknowledged via `Event.Acknowledge`. Once this happens, `callback` is invoked ONCE * * @export - * @param {*} eventName - * @param {*} timeInMilliseconds - * @param {*} callback + * @param {string} eventName + * @param {number} timeInMilliseconds + * @param {function} callback */ function Heartbeat(eventName, timeInMilliseconds, callback) { window.wails.Events.Heartbeat(eventName, timeInMilliseconds, callback); diff --git a/runtime/js/runtime/package.json b/runtime/js/runtime/package.json index 269e7347..0deaabd1 100644 --- a/runtime/js/runtime/package.json +++ b/runtime/js/runtime/package.json @@ -1,8 +1,9 @@ { "name": "@wailsapp/runtime", - "version": "1.0.2", + "version": "1.0.5", "description": "Wails Javascript runtime library", "main": "main.js", + "types": "runtime.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -20,5 +21,8 @@ "bugs": { "url": "https://github.com/wailsapp/wails/issues" }, - "homepage": "https://github.com/wailsapp/wails#readme" -} \ No newline at end of file + "homepage": "https://github.com/wailsapp/wails#readme", + "devDependencies": { + "dts-gen": "^0.5.8" + } +} diff --git a/runtime/js/runtime/runtime.d.ts b/runtime/js/runtime/runtime.d.ts new file mode 100644 index 00000000..5dde1a70 --- /dev/null +++ b/runtime/js/runtime/runtime.d.ts @@ -0,0 +1,28 @@ +export = wailsapp__runtime; + +declare const wailsapp__runtime: { + Browser: { + OpenFile(filename: string): Promise; + OpenURL(url: string): Promise; + }; + Events: { + Acknowledge(eventName: string): void; + Emit(eventName: string): void; + Heartbeat(eventName: string, timeInMilliseconds: number, callback: () => void): void; + On(eventName: string, callback: () => void): void; + OnMultiple(eventName: string, callback: () => void, maxCallbacks: number): void; + Once(eventName: string, callback: () => void): void; + }; + Init: { + Init(callback: () => void): void; + }; + Log: { + Debug(message: string): void; + Error(message: string): void; + Fatal(message: string): void; + Info(message: string): void; + Warning(message: string): void; + }; +}; + +