MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / load

Function load

projects/electron/src/modules/autoUpdate.ts:81–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79}
80
81export const load = () => {
82 // Check for updates
83 if (!isDev && !process.env.OPENADE_SMOKE_TEST) {
84 checkForUpdatesAndNotify()
85 setInterval(checkForUpdatesAndNotify, 60000 * 30) // Check for updates every 30 minutes
86 }
87
88 app.whenReady().then(() => {
89 // give them the notification again if they reload the app
90 app.on("web-contents-created", (_, contents) => {
91 contents.on("did-finish-load", () => {
92 if (pendingUpdate) {
93 setTimeout(() => {
94 notifyFeOnUpdateAvailable()
95 }, 5000)
96 }
97 })
98 })
99
100 ipcMain.handle("retry-update-check", () => {
101 return checkForUpdatesAndNotify()
102 })
103
104 ipcMain.handle("apply-update", () => {
105 pendingUpdate = false
106 autoUpdater.quitAndInstall()
107 setTimeout(() => {
108 app.quit()
109 }, 90000) // There was no update force quit so pending update/issue potentially disappears
110 })
111 })
112}

Callers

nothing calls this directly

Calls 3

checkForUpdatesAndNotifyFunction · 0.85
onMethod · 0.45

Tested by

no test coverage detected