aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorhristoterezov <hristo@jitsi.org>2016-12-12 14:46:47 -0600
committerhristoterezov <hristo@jitsi.org>2016-12-12 14:52:17 -0600
commitc07fe8fa1ec85677e83ddb0568eb0fe54985d044 (patch)
tree600c90260fdf7eda872f74a7d079e84203f1f9a0 /main.js
Initial commit
Diffstat (limited to 'main.js')
-rw-r--r--main.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..0a073fb
--- /dev/null
+++ b/main.js
@@ -0,0 +1,56 @@
+//Electron includes
+const electron = require("electron");
+const APP = electron.app;
+const BrowserWindow = electron.BrowserWindow;
+
+const path = require("path");
+const url = require("url");
+
+/**
+ * URL for index.html which will be our entry point.
+ */
+const indexURL = url.format({
+ pathname: path.join(__dirname, "windows", "jitsi-meet", "index.html"),
+ protocol: "file:",
+ slashes: true
+});
+
+/**
+ * The window object that will load the iframe with Jitsi Meet.
+ * IMPORTANT: Must be defined as global in order to not be garbage collected
+ * acidentally.
+ */
+let jitsiMeetWindow = null;
+
+/**
+ * Sets the APP object listeners.
+ */
+function setAPPListeners () {
+ APP.on("ready", createJitsiMeetWindow);
+ APP.on("window-all-closed", () => {
+ // Don"t quit the application for Mac OS
+ if (process.platform !== "darwin") {
+ APP.quit();
+ }
+ });
+ APP.on("activate", () => {
+ if (jitsiMeetWindow === null) {
+ createJitsiMeetWindow();
+ }
+ });
+}
+
+/**
+ * Opens new window with index.html(Jitsi Meet is loaded in iframe there).
+ */
+function createJitsiMeetWindow () {
+ jitsiMeetWindow = new BrowserWindow({width: 800, height: 600});
+ jitsiMeetWindow.loadURL(indexURL);
+
+ jitsiMeetWindow.on("closed", () => {
+ jitsiMeetWindow = null;
+ });
+}
+
+//Start the application:
+setAPPListeners();