Skip to content

Instantly share code, notes, and snippets.

@CharlieHess
Created October 4, 2019 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CharlieHess/5413508c619ab6f264e73b7eaec54dee to your computer and use it in GitHub Desktop.
Save CharlieHess/5413508c619ab6f264e73b7eaec54dee to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
<!-- Empty -->
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
// 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.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
nativeWindowOpen: true,
preload: require.resolve('./renderer.js')
}
})
// and load the index.html of the app.
mainWindow.loadURL('https://app.slack.com')
// Open the DevTools.
mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// 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', function () {
app.quit()
})
let picker
window.addEventListener('message', (evt) => {
console.log(evt.origin)
console.log(evt.data)
})
window.addEventListener('DOMContentLoaded', () => {
picker = window.open('https://app.slack.com/files/import/box?team=T5J4Q04QG')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment