Example #1
0
			this.folderService.load(path).then((folder) => {
				this.folder = folder;

				if (ViewFolderController.folderWatcher !== undefined) {
					ViewFolderController.folderWatcher.close();
				}

				ViewFolderController.folderWatcher = nodeFs.watch(path, (event, filename) => {
					this.loadFolder();
				});

				this.storageService.settings.currentFolder = path;
				this.storageService.saveSettings();
			});
Example #2
0
 return new Promise((resolve, reject) => {
     let watcher = fse.watch(file, (event, filename) => {
         watcher.close();
         resolve({ event, filename });
     });
 });
Example #3
0
  });
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on("ready", createWindow);

// Quit when all windows are closed.
app.on("window-all-closed", () => {
  // On macOS it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== "darwin") {
    app.quit();
  }
});

app.on("activate", () => {
  // On macOS it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (win === null) {
    createWindow();
  }
});

// for hot reload
// TODO remove it in production
fse.watch(path.join(__dirname), (event, fileName) => {
  win.webContents.reloadIgnoringCache();
});