Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "electron-updater in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'electron-updater' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

var height = 200;

// Electron app
const electron = require('electron');
const electronApp = electron.app;
console.log("Local User Data: " + electronApp.getPath('userData'))
const BrowserWindow = electron.BrowserWindow;
const Tray = electron.Tray;
const nativeImage = require('electron').nativeImage
const Menu = require('electron').Menu

var appIcon = null,
  jogWindow = null,
  mainWindow = null

const autoUpdater = require("electron-updater").autoUpdater

autoUpdater.on('checking-for-update', () => {
  var string = 'Checking for update...';
  var output = {
    'command': 'autoupdate',
    'response': string
  }
  io.sockets.emit('updatedata', output);
  if (jogWindow && !jogWindow.isFocused()) {
    appIcon.displayBalloon({
      icon: nativeImage.createFromPath(iconPath),
      title: "OpenBuilds CONTROL",
      content: string
    })
  }
})
"use strict";
exports.__esModule = true;
var electron_1 = require("electron");
var path = require("path");
var url = require("url");
var log = require("electron-log");
var electron_updater_1 = require("electron-updater");
var isDev = require("electron-is-dev");
var win, serve;
var args = process.argv.slice(1);
serve = args.some(function (val) { return val === '--serve'; });
var GITHUB_RELEASE_URL = 'https://github.com/Mokkapps/scrum-daily-standup-picker/releases';
var isLinux = process.platform === 'linux';
log.transports.file.level = 'debug';
electron_updater_1.autoUpdater.logger = log;
// Disable auto download as ASAR is disabled and therefore code signing cannot be done
electron_updater_1.autoUpdater.autoDownload = false;
log.info('App starting...');
// Manage unhandled exceptions as early as possible
process.on('uncaughtException', function (e) {
    console.error("Caught unhandled exception: " + e);
    log.error("Caught unhandled exception: " + e);
    electron_1.dialog.showErrorBox('Caught unhandled exception', e.message || 'Unknown error message');
    electron_1.app.quit();
});
function createWindow() {
    var electronScreen = electron_1.screen;
    var size = electronScreen.getPrimaryDisplay().workAreaSize;
    // Create the browser window.
    win = new electron_1.BrowserWindow({
        webPreferences: {
app.on("window-all-closed", () => {
  if (process.platform !== "darwin") {
    app.quit()
  }
})

app.on("activate", () => {
  if (win === null) {
    createWindow()
  }
})

/* auto-update */

if (settings.autoUpdaterAllowPrerelease) {
  autoUpdater.allowPrerelease = true
}

// autoUpdater.fullChangelog = true
autoUpdater.autoDownload = false

var currentVersion

autoUpdater.checkForUpdates()
.then((updateCheckResult) => {
  let info = updateCheckResult.updateInfo
  console.log(info, info.releaseNotes)

  var isNewer = false;
  currentVersion = package.version
  let cvs = currentVersion.split(".").map(s => Number(s))
  let uvs = info.version.split(".").map(s => Number(s))
// On macOS it's normal to quit the app only when you do apple-Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

function sendStatusToWindow(text) {
  const aboutWindow = openAboutWindow()
  log.info(text)
  aboutWindow.webContents.send('update-message', text)
}

autoUpdater.on('checking-for-update', () => {
  sendStatusToWindow('Checking for update...')
})
autoUpdater.on('update-available', () => {
  sendStatusToWindow('Update available.')
})
autoUpdater.on('update-not-available', () => {
  sendStatusToWindow('Update not available.')
})
autoUpdater.on('error', (err) => {
  sendStatusToWindow('Error in auto-updater. ' + err)
})
autoUpdater.on('download-progress', (progressObj) => {
  let log_message = 'Download speed: ' + progressObj.bytesPerSecond
  log_message = log_message + ' - Downloaded ' + progressObj.percent + '%'
  log_message = log_message + ' (' + progressObj.transferred + '/' + progressObj.total + ')'
  sendStatusToWindow(log_message)
})
autoUpdater.on('update-downloaded', () => {
  sendStatusToWindow('Update downloaded. Quitting and installing.')
});
    autoUpdater.on('checking-for-update', () => {
        sendUpdateMessage(mainWindow, message.checking)
    });
    autoUpdater.on('update-available', (info) => {
        sendUpdateMessage(mainWindow, message.updateAva)
    });
    autoUpdater.on('update-not-available', (info) => {
        sendUpdateMessage(mainWindow, message.updateNotAva)
    });

    // 更新下载进度事件
    autoUpdater.on('download-progress', (progressObj) => {
        mainWindow.webContents.send('downloadProgress', progressObj)
    })
    autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) => {
        dialog.showMessageBox({
            type: 'question',
            title: '提示',
            defaultId: 0,
            cancelId: 1,
            message: "检测到新版本,更新会退出应用,是否立即更新?",
            buttons: ['立即更新', '否'],
            icon: path.join(__resources, 'icon', 'icon.png')
        }, (index) => {
            if(index === 0){
				KillAll().then(() => {
					setImmediate(() => {
						autoUpdater.quitAndInstall(); 
						app.quit()
					})
				})
//   };

  //   dialog.showMessageBox(dialogOpts, (response) => {
  //     if (response === 0) {
  //       autoUpdater.quitAndInstall();
  //     }
  //   });
  // });

  // autoUpdater.on('error', message => {
  //   console.error('There was a problem updating the application');
  //   console.error(message);
  // });

  log.transports.file.level = 'info';
  autoUpdater.logger = log;
  // autoUpdater.checkForUpdatesAndNotify();
  autoUpdater.checkForUpdates();
};
const electron = require('electron');
const {app, BrowserWindow, dialog} = electron;
const path = require('path');
const url = require('url');
const settings = require('electron-settings');
const log = require('electron-log');
const {autoUpdater} = require("electron-updater");
const EA = require("electron-analytics");
const ipc = electron.ipcMain;
EA.init("Bkles-YA1-");

require('electron-debug')({showDevTools: false});

// Logging
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = "info";
// autoUpdater.autoDownload = false;
autoUpdater.allowPrerelease = false;
log.info('App Starting');

let manualupdate = false;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
require('electron-context-menu')();

let win;

function sendStatusToWindow(text) {
  log.info('', text);
  // win.webContents.send('message', text);
}
app.on('ready', () => {
  loadConfigs();

  if (isPortableConfig()) {
    const logDir = path.join(configDir(), "logs");

    log.transports.file.resolvePath = (variables) => path.join(logDir, variables.fileName);
  }

  log.transports.console.level = "warn"
  log.transports.file.level = "debug"
  autoUpdater.logger = log

  if (maybeMoveToApplicationsFolder()) {
    return
  }

  checkForUpdates();

  // re-check for updates every 24 hours
  setInterval(checkForUpdates, 86400000);

  tray = new Tray(
    path.join(
      resourcesPath(), 'icons',
      selectByOS({ mac: 'kopia-tray.png', win: 'kopia-tray.ico', linux: 'kopia-tray.png' })));

  tray.setToolTip('Kopia');
const { app, BrowserWindow, shell, Menu, protocol, webFrame, ipcMain } = require('electron');
const autoUpdater = require('electron-updater').autoUpdater;
const url = require('url');
const path = require('path');

// const TransportNodeHid = require('@ledgerhq/hw-transport-node-hid');

app.setAsDefaultProtocolClient('xrb'); // Register handler for xrb: links

console.log(`Starting ledger@!`);

const ledger = require('./desktop-app/src/lib/ledger');

ledger.initialize();

// const Ledger = new ledger();

// Ledger.loadLedger();
const { app, dialog, shell, globalShortcut, ipcMain, BrowserWindow, Menu, Tray } = require("electron")
const path = require("path")
const url = require("url")
const autoUpdater = require("electron-updater").autoUpdater
const fs = require("fs")
const i18n = require("./lib/i18n.js")
const request = require("request")

let win, tray, menu // keep globals

const package = require("./package.json");

const configDirName = "cumulonimbus"
const configDirPath = path.join( path.parse(app.getPath("userData")).dir, configDirName )
try {
  fs.mkdirSync(configDirPath)
} catch (exp) {
  console.log("Looks like config dir already exists, continuing")
}
app.setPath("userData", configDirPath)

Is your System Free of Underlying Vulnerabilities?
Find Out Now