5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 07:21:32 +08:00
wails/runtime/js/core/main.js
2019-10-08 06:12:08 +11:00

55 lines
1.0 KiB
JavaScript

/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The lightweight framework for web-like apps
(c) Lea Anthony 2019-present
*/
/* jshint esversion: 6 */
import * as Log from './log';
import * as Browser from './browser';
import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
import { NewBinding } from './bindings';
import { Callback } from './calls';
import { AddScript, InjectCSS } from './utils';
// Initialise global if not already
window.wails = window.wails || {};
window.backend = {};
// Setup internal calls
var internal = {
NewBinding,
Callback,
Notify,
AddScript,
InjectCSS,
Init,
};
// Setup runtime structure
var runtime = {
Log,
Browser,
Events: {
On,
OnMultiple,
Emit,
Heartbeat,
Acknowledge,
},
_: internal,
};
// Augment global
Object.assign(window.wails, runtime);
// Emit loaded event
Emit('wails:loaded');
// Nothing to init in production
export function Init(callback) {
callback();
}