Last active
December 22, 2016 05:55
-
-
Save taishi41228/e2aa1e083f229d5fb92836ce84701ddc to your computer and use it in GitHub Desktop.
Hello Electron!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require('electron'); | |
const { | |
app, | |
BrowserWindow | |
} = electron; | |
const fs = require("fs"); | |
app.on('ready', function () { | |
function isExistFile(file) { | |
try { | |
fs.statSync(file); | |
return true | |
} catch(err) { | |
if(err.code === 'ENOENT') return false | |
} | |
} | |
if(isExistFile('./loading.gif')){ | |
console.log("あるよ"); | |
}else{ | |
console.log("ないよ"); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ファイルを | |
// src | |
// |-- index.html | |
// |-- main.js | |
const electron = require('electron'); | |
const { | |
app, | |
BrowserWindow | |
} = electron; | |
let win; | |
app.on('ready', function () { | |
win = new BrowserWindow({ | |
title: 'Hello Electron!!', | |
width: 600, | |
height: 600 | |
}); | |
win.loadURL(`file://${__dirname}/index.html`); | |
// win.loadURL(`file://${__dirname}/loading.gif`);でも可能 | |
win.on('closed', () => { | |
win = null; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment