You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
784 B
29 lines
784 B
"use strict";
|
|
const {app, protocol} = require("electron");
|
|
const url = require("url");
|
|
const path = require("path");
|
|
|
|
const WindowManager = require("./WindowManager");
|
|
|
|
class Ation {
|
|
windowManager;
|
|
|
|
constructor() {
|
|
if (Ation.Instances > 0)
|
|
throw new Error("Only one Instance of Ation possible");
|
|
this.windowManager = new WindowManager();
|
|
|
|
app.whenReady().then(async () => {
|
|
protocol.registerFileProtocol("slideimg", (request, callback) => {
|
|
const uri = request.url.replace(/^slideimg:\/\//, "");
|
|
const extension = path.extname(uri).replace(/^\./, "");
|
|
|
|
if (["png", "jpg", "jpeg", "svg", "bmp", "gif", "tiff"].includes(extension.toLowerCase()))
|
|
callback(uri);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
Ation.Instances = 0;
|
|
|
|
module.exports = Ation; |