Closed govpack closed 8 years ago
Like nw.exe but not as flakey, Electron is a great way to make full trust hybrid Desktop Apps. It has facilities for Taskbar integration, Notifications, App updates, packaging & distribution, as well as interprocess communication (ipc) between the node process controlling the App (aka: package.json.main or index.js) and the web page (aka: render thread) with protocol handlers and lots of events and methods for running many of the Browser internals, including gems like
prompt(1,2)
delightfully informing us: Error: prompt() is and will not be supported.
(never say never especially with open source).
I have done very little with Electron, except this... which takes a url as an argument and opens it, like a browser does, because it is one.
var app=require('app')
var mainWindow=null
var BrowserWindow=require('browser-window')
app.on('window-all-closed',function(){app.quit()})
app.on('ready',function(){
app.setApplicationMenu(null) // nix the default menu bar
mainWindow=new BrowserWindow({title:'',width:600,height:300,frame:true,resizeable:true,icon:'./b.ico'})
mainWindow.maximize()
var url=process.argv.slice(2).join(' ')
mainWindow.loadURL(url)
mainWindow.on('closed',function(){mainWindow=null})
})
Which I run with:
"C:/blah/node_modules/electron-prebuilt/dist/electron.exe" C:/blah/electron.js "http://electron.atom.io/docs/all/"
electron.js / or index.js / or the script referenced in package.json.main
So you've got a NODE process running a BROWSER process, and one can reach out to the other via messaging or remote calls, like this from the web page...
require('electron').remote.getCurrentWebContents().toggleDevTools()
ie run npm install electron-prebuilt -gf
write a little index.js (something like the one above) and you're probably good to go.
I had a simple fastn.js app going in electron some time back which I could demo.
(re the fastn.js App, I'm sure Kory would be happy, anything with Electron would be good to demo)
Unfortunately, we don’t support that file type. Choose Files Try again with a PNG, GIF, JPG, DOCX, PPTX, XLSX, TXT, PDF, or ZIP.
Hi Yall,
I've made a popcorn time / netflix style torrent streaming app that runs in electron, finds torrents automatically and saves it to a JSON database (the db needs improvement). Its pretty cool but doesn't leverage a lot of electron features as I just needed a way to run nodejs on someone's machine without me needing to walk them through setting it up. I use this as almost my entire source of TV at home, other than actual netflix. Its pretty buggy really, but again, its for private consumption so it gets fixed when I feel like it.
https://github.com/rknell/torrent-bot3
There is a gulp file that copies over the data and does the "install" on electron gulp build:electron
. I'm pretty sure this isn't the way to do it, but it works for me. It also needs binaries unfortunately because it has chromecast support and that needs mDNS/Bonjour to find the devices on the network
For the pre-compiled electron version check this: https://www.dropbox.com/s/p0iczpyxs4vbfp3/TorrentBot.zip?dl=1
edit: Changed download link to zip so it deals. Also note its only for OSX
@rknell
That sounds fantastic. I'd love to know the essence of how you made that work. I was really impressed by popcorn time, how it made browsing+consuming torrents a much more pleasant arrangement -- to be able to do that one's self is amazing. Thanks for sharing project info & links. I'd be keen to hear your explanation of what was involved.
@govpack @shotlom @rknell This one's interesting. How would you folks like to do a 7 minute lightning talk each on your apps, and share your findings at the April 4 meetup?
Kind of a show-and tell format with some Q&A at the end could be interesting.
@govpack @shotlom @rknell We have a shortage of speakers for the next meetup, can you step up to the challenge? Doesn't have to be anything too fancy. :D
I'll try - is anyone interested in maybe in doing a collaboration at the Edge on the Sunday? More hands make better exmples
On Thu, Mar 24, 2016 at 10:56 AM, Ash Kyd notifications@github.com wrote:
@govpack https://github.com/govpack @shotlom https://github.com/shotlom @rknell https://github.com/rknell We have a shortage of speakers for the next meetup, can you step up to the challenge? Doesn't have to be anything too fancy. :D
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/BrisJS/meetups/issues/123#issuecomment-200601631
Mr Sholto Maud
mobile: +61 (0) 424 094 227 email: sholto.maud@gmail.com skype: sholtomaud
@AshKyd yes, let's do some combined Electron talks April 4th
@rknell @shotlom Yeah, I'd be interested in going to the library on Sunday the 3rd, the Edge opens at midday so maybe at like 2pm. I don't want to over do it, but I do want to try out more of the API.
Here's another way to have a look at what's inside the Electron API /// type defs: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/github-electron/github-electron.d.ts
they almost make fun of themselves, on second thoughts who isn't? the whole world is like that these days onya, funny little bunnies
Thanks folks, how'd your Saturday go?
I've scheduled this one in. Just to confirm @govpack and @shotlom are both gonna say some words? :)
I'm 50-50 just in London so might not be over the jetlag enough for an effective demo, nor the session at the Edge on Sunday - will keep you posted
On Sun, Mar 27, 2016 at 4:05 AM, Ash Kyd notifications@github.com wrote:
Thanks folks, how'd your Saturday go?
I've scheduled this one in. Just to confirm @govpack https://github.com/govpack and @shotlom https://github.com/shotlom are both gonna say some words? :)
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/BrisJS/meetups/issues/123#issuecomment-201978953
Mr Sholto Maud
mobile: +61 (0) 424 094 227 email: sholto.maud@gmail.com skype: sholtomaud
I am sure a jet lagged @shotlom is a funny @shotlom
@shotlom -- just to say that i've read that, and that's fine by me, i started having a closer look at electron today, i wouldn't think it would mix well with jet lag, i will stay in the office, where i can get a bit more done.
//mainWindow=new BrowserWindow({...})
mainWindow.capturePage( /*[clipRect],*/function(nativeImage){
//nativeImage.getSize()
fs.writeFile('C:\\screenshot.png',nativeImage.toPng(),function(err){console.log(err)})
}
)
wont be at the edge today :(
@shotlom: Hoping you'll be able to stand up and say a couple of words about your app tonight? :)
hey mate, sorry tried to give you notice on gitter, I'm sick as a dog, caught a throat infection on plane & can't actually speak. my apologies, I wont make it
On Mon, Apr 4, 2016 at 11:45 AM, Ash Kyd notifications@github.com wrote:
@shotlom https://github.com/shotlom: Hoping you'll be able to stand up and say a couple of words about your app tonight? :)
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/BrisJS/meetups/issues/123#issuecomment-205101414
Mr Sholto Maud
mobile: +61 (0) 424 094 227 email: sholto.maud@gmail.com skype: sholtomaud
@shotlom No probs, get well soon and we'll see you at the next one!
@govpack Thanks for speaking, it was good to go through what Electron can do. Do you have any resources you'd like to share from your talk?
@AshKyd
no worries, when it came down to it the clearest way to getting started with electron was to reflect on what require('electron') returns,
something like require('util').inspect(require('electron'))
...
{ hideInternalModules: [Function],
clipboard: [Getter],
crashReporter: [Getter],
deprecations: [Getter],
nativeImage: [Getter],
shell: [Getter],
app: [Getter],
autoUpdater: [Getter],
BrowserWindow: [Getter],
contentTracing: [Getter],
dialog: [Getter],
ipcMain: [Getter],
globalShortcut: [Getter],
Menu: [Getter],
MenuItem: [Getter],
powerMonitor: [Getter],
powerSaveBlocker: [Getter],
protocol: [Getter],
screen: [Getter],
session: [Getter],
Tray: [Getter] }
and the inspection of the whole require('electron') tree...
E.hideInternalModules()
E.clipboard.availableFormats()
E.clipboard.has()
E.clipboard.read()
E.clipboard.write()
E.clipboard.readText()
E.clipboard.writeText()
E.clipboard.readRtf()
E.clipboard.writeRtf()
E.clipboard.readHtml()
E.clipboard.writeHtml()
E.clipboard.readImage()
E.clipboard.writeImage()
E.clipboard.clear()
E.crashReporter.start(options)
E.crashReporter.getLastCrashReport()
E.crashReporter.getUploadedReports()
E.deprecations.setHandler(deprecationHandler)
E.deprecations.getHandler()
E.nativeImage.createEmpty()
E.nativeImage.createFromPath()
E.nativeImage.createFromBuffer()
E.nativeImage.createFromDataURL()
E.nativeImage.createFromDataUrl()
E.shell.showItemInFolder()
E.shell.openItem()
E.shell.openExternal()
E.shell.moveItemToTrash()
E.shell.beep()
E.app.quit()
E.app.exit()
E.app.focus()
E.app.getVersion()
E.app.setVersion()
E.app.getName()
E.app.setName()
E.app.isReady()
E.app.addRecentDocument()
E.app.clearRecentDocuments()
E.app.setAppUserModelId()
E.app.setAsDefaultProtocolClient()
E.app.removeAsDefaultProtocolClient()
E.app.setUserTasks()
E.app.isAeroGlassEnabled()
E.app.setPath()
E.app.getPath()
E.app.setDesktopName()
E.app.allowNTLMCredentialsForAllDomains()
E.app.getLocale()
E.app.makeSingleInstance()
E.app.setApplicationMenu(menu)
E.app.getApplicationMenu()
E.app.commandLine.appendSwitch()
E.app.commandLine.appendArgument()
E.app.setAppPath(path)
E.app.getAppPath()
E.app._events.login(event, webContents, ...args)
E.app._events.certificate-error(event, webContents, ...args)
E.app._events.select-client-certificate.0(event, webContents, ...args)
E.app._events.select-client-certificate.1(...args)
E.app._events.ready.0(...args)
E.app._events.ready.1()
E.app._events.activate(...args)
E.app._events.quit(event, exitCode)
E.app._events.will-quit()
E.app._events.window-all-closed.0()
E.app._events.window-all-closed.1()
E.app._eventsCount = 8
E.app.getHomeDir()
E.app.getDataPath()
E.app.setDataPath()
E.app.resolveProxy()
E.app.terminate()
E.app.domain = undefined
E.app._maxListeners ◀◀.app.domain▶▶
E.app.setMaxListeners(n)
E.app.getMaxListeners()
E.app.emit(type)
E.app.addListener(type, listener)
E.app.on ◀◀.app.addListener▶▶
E.app.once(type, listener)
E.app.removeListener(type, listener)
E.app.removeAllListeners(type)
E.app.listeners(type)
E.app.listenerCount(type)
E.app.eventNames()
E.autoUpdater.domain = null
E.autoUpdater._eventsCount = 0
E.autoUpdater._maxListeners ◀◀.app.domain▶▶
E.autoUpdater.setFeedUrl()
E.autoUpdater.quitAndInstall()
E.autoUpdater.setFeedURL(updateURL)
E.autoUpdater.checkForUpdates()
E.autoUpdater.emitError(message)
E.autoUpdater.setMaxListeners ◀◀.app.setMaxListeners▶▶
E.autoUpdater.getMaxListeners ◀◀.app.getMaxListeners▶▶
E.autoUpdater.emit ◀◀.app.emit▶▶
E.autoUpdater.addListener ◀◀.app.addListener▶▶
E.autoUpdater.on ◀◀.app.addListener▶▶
E.autoUpdater.once ◀◀.app.once▶▶
E.autoUpdater.removeListener ◀◀.app.removeListener▶▶
E.autoUpdater.removeAllListeners ◀◀.app.removeAllListeners▶▶
E.autoUpdater.listeners ◀◀.app.listeners▶▶
E.autoUpdater.listenerCount ◀◀.app.listenerCount▶▶
E.autoUpdater.eventNames ◀◀.app.eventNames▶▶
E.BrowserWindow()
E.contentTracing.getCategories()
E.contentTracing.startRecording()
E.contentTracing.stopRecording()
E.contentTracing.getTraceBufferUsage()
E.contentTracing.setWatchEvent()
E.contentTracing.cancelWatchEvent()
E.dialog.showOpenDialog(...args)
E.dialog.showSaveDialog(...args)
E.dialog.showMessageBox(...args)
E.dialog.showErrorBox(...args)
E.ipcMain.domain ◀◀.autoUpdater.domain▶▶
E.ipcMain._events.ATOM_BROWSER_REQUIRE(event, module)
E.ipcMain._events.ATOM_BROWSER_GET_BUILTIN(event, module)
E.ipcMain._events.ATOM_BROWSER_GLOBAL(event, name)
E.ipcMain._events.ATOM_BROWSER_CURRENT_WINDOW(event)
E.ipcMain._events.ATOM_BROWSER_CURRENT_WEB_CONTENTS(event)
E.ipcMain._events.ATOM_BROWSER_CONSTRUCTOR(event, id, args)
E.ipcMain._events.ATOM_BROWSER_FUNCTION_CALL(event, id, args)
E.ipcMain._events.ATOM_BROWSER_MEMBER_CONSTRUCTOR(event, id, method, args)
E.ipcMain._events.ATOM_BROWSER_MEMBER_CALL(event, id, method, args)
E.ipcMain._events.ATOM_BROWSER_MEMBER_SET(event, id, name, value)
E.ipcMain._events.ATOM_BROWSER_MEMBER_GET(event, id, name)
E.ipcMain._events.ATOM_BROWSER_DEREFERENCE(event, id)
E.ipcMain._events.ATOM_BROWSER_GUEST_WEB_CONTENTS(event, guestInstanceId)
E.ipcMain._events.ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW(event, requestId, guestInstanceId, method, ...args)
E.ipcMain._events.ATOM_SHELL_NAVIGATION_CONTROLLER(event, method, ...args)
E.ipcMain._events.ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER(event, method, ...args)
E.ipcMain._events.ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST(event, params, requestId)
E.ipcMain._events.ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST(event, elementInstanceId, guestInstanceId, params)
E.ipcMain._events.ATOM_SHELL_GUEST_VIEW_MANAGER_DESTROY_GUEST(event, id)
E.ipcMain._events.ATOM_SHELL_GUEST_VIEW_MANAGER_SET_SIZE(event, id, params)
E.ipcMain._events.ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN(event, url, frameName, disposition, options)
E.ipcMain._events.ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE(event, guestId)
E.ipcMain._events.ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD(event, guestId, method, ...args)
E.ipcMain._events.ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE(event, guestId, message, targetOrigin, sourceOrigin)
E.ipcMain._events.ATOM_SHELL_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD(event, guestId, method, ...args)
E.ipcMain._events.ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES(event, captureWindow, captureScreen, thumbnailSize, id)
E.ipcMain._eventsCount = 26
E.ipcMain._maxListeners ◀◀.app.domain▶▶
E.ipcMain.setMaxListeners ◀◀.app.setMaxListeners▶▶
E.ipcMain.getMaxListeners ◀◀.app.getMaxListeners▶▶
E.ipcMain.emit ◀◀.app.emit▶▶
E.ipcMain.addListener ◀◀.app.addListener▶▶
E.ipcMain.on ◀◀.app.addListener▶▶
E.ipcMain.once ◀◀.app.once▶▶
E.ipcMain.removeListener ◀◀.app.removeListener▶▶
E.ipcMain.removeAllListeners ◀◀.app.removeAllListeners▶▶
E.ipcMain.listeners ◀◀.app.listeners▶▶
E.ipcMain.listenerCount ◀◀.app.listenerCount▶▶
E.ipcMain.eventNames ◀◀.app.eventNames▶▶
E.globalShortcut.register()
E.globalShortcut.isRegistered()
E.globalShortcut.unregister()
E.globalShortcut.unregisterAll()
E.Menu()
E.MenuItem(options)
E.powerMonitor.domain ◀◀.app.domain▶▶
E.powerMonitor._events ◀◀.app.domain▶▶
E.powerMonitor._maxListeners ◀◀.app.domain▶▶
E.powerMonitor.setMaxListeners ◀◀.app.setMaxListeners▶▶
E.powerMonitor.getMaxListeners ◀◀.app.getMaxListeners▶▶
E.powerMonitor.emit ◀◀.app.emit▶▶
E.powerMonitor.addListener ◀◀.app.addListener▶▶
E.powerMonitor.on ◀◀.app.addListener▶▶
E.powerMonitor.once ◀◀.app.once▶▶
E.powerMonitor.removeListener ◀◀.app.removeListener▶▶
E.powerMonitor.removeAllListeners ◀◀.app.removeAllListeners▶▶
E.powerMonitor.listeners ◀◀.app.listeners▶▶
E.powerMonitor.listenerCount ◀◀.app.listenerCount▶▶
E.powerMonitor.eventNames ◀◀.app.eventNames▶▶
E.powerSaveBlocker.start()
E.powerSaveBlocker.stop()
E.powerSaveBlocker.isStarted()
E.protocol.registerStandardSchemes()
E.protocol.registerServiceWorkerSchemes()
E.protocol.registerStringProtocol()
E.protocol.registerBufferProtocol()
E.protocol.registerFileProtocol()
E.protocol.registerHttpProtocol()
E.protocol.unregisterProtocol()
E.protocol.isProtocolHandled()
E.protocol.interceptStringProtocol()
E.protocol.interceptBufferProtocol()
E.protocol.interceptFileProtocol()
E.protocol.interceptHttpProtocol()
E.protocol.uninterceptProtocol()
E.protocol.registerProtocol(scheme, handler, callback)
E.protocol.isHandledProtocol(scheme, callback)
E.protocol.interceptProtocol(scheme, handler, callback)
E.screen.getCursorScreenPoint()
E.screen.getPrimaryDisplay()
E.screen.getAllDisplays()
E.screen.getDisplayNearestPoint()
E.screen.getDisplayMatching()
E.screen.domain ◀◀.app.domain▶▶
E.screen._events ◀◀.app.domain▶▶
E.screen._maxListeners ◀◀.app.domain▶▶
E.screen.setMaxListeners ◀◀.app.setMaxListeners▶▶
E.screen.getMaxListeners ◀◀.app.getMaxListeners▶▶
E.screen.emit ◀◀.app.emit▶▶
E.screen.addListener ◀◀.app.addListener▶▶
E.screen.on ◀◀.app.addListener▶▶
E.screen.once ◀◀.app.once▶▶
E.screen.removeListener ◀◀.app.removeListener▶▶
E.screen.removeAllListeners ◀◀.app.removeAllListeners▶▶
E.screen.listeners ◀◀.app.listeners▶▶
E.screen.listenerCount ◀◀.app.listenerCount▶▶
E.screen.eventNames ◀◀.app.eventNames▶▶
E.session.fromPartition(partition)
E.session.defaultSession.destroy()
E.session.defaultSession.isDestroyed()
E.session.defaultSession.resolveProxy()
E.session.defaultSession.getCacheSize()
E.session.defaultSession.clearCache()
E.session.defaultSession.clearStorageData()
E.session.defaultSession.flushStorageData()
E.session.defaultSession.setProxy()
E.session.defaultSession.setDownloadPath()
E.session.defaultSession.enableNetworkEmulation()
E.session.defaultSession.disableNetworkEmulation()
E.session.defaultSession.setCertificateVerifyProc()
E.session.defaultSession.setPermissionRequestHandler()
E.session.defaultSession.clearHostResolverCache()
E.session.defaultSession.cookies.get()
E.session.defaultSession.cookies.remove()
E.session.defaultSession.cookies.set()
E.session.defaultSession.webRequest.onBeforeRequest()
E.session.defaultSession.webRequest.onBeforeSendHeaders()
E.session.defaultSession.webRequest.onHeadersReceived()
E.session.defaultSession.webRequest.onSendHeaders()
E.session.defaultSession.webRequest.onBeforeRedirect()
E.session.defaultSession.webRequest.onResponseStarted()
E.session.defaultSession.webRequest.onCompleted()
E.session.defaultSession.webRequest.onErrorOccurred()
E.session.defaultSession.domain ◀◀.app.domain▶▶
E.session.defaultSession._events ◀◀.app.domain▶▶
E.session.defaultSession._maxListeners ◀◀.app.domain▶▶
E.session.defaultSession.setMaxListeners ◀◀.app.setMaxListeners▶▶
E.session.defaultSession.getMaxListeners ◀◀.app.getMaxListeners▶▶
E.session.defaultSession.emit ◀◀.app.emit▶▶
E.session.defaultSession.addListener ◀◀.app.addListener▶▶
E.session.defaultSession.on ◀◀.app.addListener▶▶
E.session.defaultSession.once ◀◀.app.once▶▶
E.session.defaultSession.removeListener ◀◀.app.removeListener▶▶
E.session.defaultSession.removeAllListeners ◀◀.app.removeAllListeners▶▶
E.session.defaultSession.listeners ◀◀.app.listeners▶▶
E.session.defaultSession.listenerCount ◀◀.app.listenerCount▶▶
E.session.defaultSession.eventNames ◀◀.app.eventNames▶▶
E.Tray()
the index.js or electron app i used for the demo was... (given that one has to wait for some of those things to load before one can use them)
global.app=require('app')
global.E=require('electron')
then=Date.now()
global.L=console.log
var win=null
var winEvents='blur|focus|devtools-opened|closed'.split('|')
var webContentsEvents='navigation-entry-commited|pepper-context-menu|did-fail-provisional-load|-page-title-updated|page-title-updated|-new-window|move|activate|crashed|devtools-focused|devtools-opened|devtools-closed|did-finish-load|will-destroy|did-navigate|render-view-deleted'.split('|') //++ |ipc-message|ipc-message-sync|
var appEvents='login|certificate-error|select-client-certificate|ready|activate|quit|will-quit|window-all-closed|browser-window-focus|will-finish-launching|before-quit|open-file|open-url|browser-window-blur|browser-window-created|gpu-process-crashed|platform-theme-changed'.split('|')
var fs=require('fs')
global.ipcMain = E.ipcMain;
ipcMain.on('asynchronous-message', function(event,x){
console.log(x);
try{reV=eval(x);console.log(reV)}catch(er){console.log(er);reV=er}
event.sender.send('asynchronous-reply', l.j(reV) );
})
global.mainWindow=null
function init(){
app.on('window-all-closed',function(){app.quit()})
app.on('browser-window-focus',function(ev,win){L('browser-window-focus ~ '+'win.id:'+win.id)})
app.on('ready',next)
app.makeSingleInstance(function(argv, workingDirectory){L(argv, workingDirectory)})
}
init()
function next(){
global.screen=E.screen
app.setApplicationMenu(null)
clipboard=E.clipboard
crashReporter=E.crashReporter
nativeImage=E.nativeImage
screen=E.screen
shell=E.shell
app=E.app
ipcMain=E.ipcMain
autoUpdater=E.autoUpdater
BrowserWindow=E.BrowserWindow // the old way of making some of these objects WAS: require('browser-window') etc
contentTracing=E.contentTracing
dialog=E.dialog
globalShortcut=E.globalShortcut
Menu=E.Menu
MenuItem=E.MenuItem
powerMonitor=E.powerMonitor
powerSaveBlocker=E.powerSaveBlocker
protocol=E.protocol
session=E.session
webContents=E.webContents
Tray=E.Tray
mainWindow=new BrowserWindow({x:0,y:0,title:'',width:800,height:1080,webPreferences:{webSecurity:false}})
win=mainWindow
//win.setProgressBar(0);setTimeout(BP,20)
var url='file://' + __dirname + '/a.htm'
console.log(url)
mainWindow.loadURL(url)
mainWindow.on('closed',function(){mainWindow=null})
//mainWindow.toggleDevTools()
global.webContents=win.webContents
webContents.addListener('did-finish-load',wnup)
}
function wnup(){return
mainWindow.webContents.setZoomLevel(1.4)
L('webContents ========== did-finish-load')
mainWindow.webContents.send('blah',{hello:123,world:true})
for(var i=0;i<appEvents.length;i++){app.addListener(appEvents[i],(function(x){return function(){appEVENT.apply(null,[x].concat([].slice.apply(arguments)))}})(appEvents[i]))}
for(var i=0;i<winEvents.length;i++){mainWindow.addListener(winEvents[i],(function(x){return function(){winEVENT.apply(null,[x].concat([].slice.apply(arguments)))}})(winEvents[i]))}
for(var i=0;i<webContentsEvents.length;i++){mainWindow.webContents.addListener(webContentsEvents[i],(function(x){return function(){webContentsEVENT.apply(null,[x].concat([].slice.apply(arguments)))}})(webContentsEvents[i]))}
}
function appEVENT(x,ev){L(x);webContents.send('appEVENT',{title:x,body:'app'})}
function winEVENT(x,ev){L(x);webContents.send('winEVENT',{title:x,body:'BrowserWindow'})}
function webContentsEVENT(x,ev){L(x);webContents.send('webContentsEVENT',{title:x,body:'webContents'})}
function BP(){var ms=Date.now()-then;
if(ms>10000){then=Date.now()}else{win.setProgressBar((ms/10000))}
setTimeout(BP,5)
}
It's important to note, the above code is running in electron.exe, since require('electron') won't work from node!! But what we do do is to get node to launch electron, which is easy to copy after running npm install -gf electron-prebuilt
from the node_modules\electron-prebuilt\dist\*.*
folder. I renamed the exe to "e.exe" and have a script "e.js" to run e.exe if I want to see the console output.
var exe=__filename.replace('.js','.exe')
var cp=require('child_process')
console.log(exe)
var ec=cp.spawn(exe,process.argv.slice(2),{stdio:'inherit'})
ec.on('close',function(n){process.exit(n)})
as it says when you run electron.exe
To run your app with Electron, execute the following command in your Console (or Terminal):
~/dist/electron.exe path-to-your-app
The path-to-your-app should be the path to your own Electron app.
Where "path-to-your-app" would be a folder with a package.json with main:'app.js' set, or failing that just an index.js as to run as your app.
Boy that's verbose On 23 Apr 2016 1:56 PM, "govpack" notifications@github.com wrote:
It's important to note, the above code is running in electron.exe, since require('electron') won't work from node!! But what we do do is to get node to launch electron, which is easy to copy after running npm install -gf electron-prebuilt from the node_modules\electron-prebuilt\dist. folder. I renamed the exe to "e.exe" and have a script "e.js" to run e.exe if I want to see the console output. e.js
var exe=__filename.replace('.js','.exe')var cp=require('child_process')console.log(exe)var ec=cp.spawn(exe,process.argv.slice(2),{stdio:'inherit'})ec.on('close',function(n){process.exit(n)})
node_modules\electron-prebuilt\dist\
[image: image] https://cloud.githubusercontent.com/assets/8147200/14759102/2ba616be-0959-11e6-89ae-04ddbd1bc782.png
as it says when you run electron.exe
To run your app with Electron, execute the following command in your Console (or Terminal): ~/dist/electron.exe path-to-your-app The path-to-your-app should be the path to your own Electron app.
Where "path-to-your-app" would be a folder with a package.json with main:'app.js' set, or failing that just an index.js as to run you app.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/BrisJS/meetups/issues/123#issuecomment-213661017
@rknell verbiage (like cabbage) is good for you
Greetings BrisJS, fellow attention whores, sick & twisted f'ckers, readers of things online, the broader github community
@MauriceButler @Vheissu @eddieajau @marklawlor @iamkevinv @rknell @ridget @AshKyd @colingourlay @xwipeoutx @garrows @korynunn @tatey @louisstow @PandaWhisperer @spidie @shotlom
I hope and trust you are all well.
I'm making this thread for those interested in sharing some of the learnings+doings regarding github's Electron userAgent.
My current breakfast time reading is http://electron.atom.io/docs/all/ which runs to 173 printed pages, and here https://github.com/atom/electron/tree/master/docs and maybe soon the source code from the examples listed at: https://github.com/sindresorhus/awesome-electron
The challenge here would be to fire up the Quickstart guide, and make something with Electron, use some of the obscure APIs and maybe be able to say what you found in a group talk in a month or two (April / May) perhaps meeting the Sunday before the meetup to discuss & RUN findings in more detail.
As always, you are free to post your thoughts, notes, & discoveries here, i will be doing so too. If Kevin or someone could post a summarized version of this to the meetup mailing list that would be good, it would make it more fun if more people got involved.
cheers