성준영

electron 데스크탑 앱 구조 초기화

node_modules/
\ No newline at end of file
node_modules/
......
/desktop-app
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>KLAS 파일다운로더</title>
<script>if (typeof module === 'object') {
window.module = module;
module = undefined;
}</script>
<!-- jquery -->
<script src="public/js/jquery-3.2.1.min.js"></script>
<script>if (window.module) module = window.module;</script>
</head>
<body>
<script src="./logics.js"></script>
<h1>KLAS FILE DOWNLOADER</h1>
<button class="testBtn">테스트</button>
</body>
</html>
This diff is collapsed. Click to expand it.
var functions = require('./functions');
exports.getLectureList = function (id, pw, cb) {
functions.login(id, pw)
.then(functions.getLecture)
.then(functions.getLectureLink)
.then(function(res){
cb(res);
})
.catch(function(err){
cb(err);
})
};
exports.getLectureFileLinks = function(lectureLink, cb){
functions.getClassPageBody(lectureLink)
.then(functions.findFiles)
.then(function(res){
cb(res);
})
.catch(function(err){
cb(err);
})
};
\ No newline at end of file
/**
* Created by junyoung on 2017. 6. 7..
*/
var klasFD = require('./klasFD/module');
$(document).ready(function(){
$('.testBtn').click(function(){
klasFD.getLectureList('2012104095', 'Sung167300', function(res){
console.log(res);
var lectureLinkObj = res[2];
klasFD.getLectureFileLinks(lectureLinkObj, function(res){
console.log(res);
})
});
})
});
\ No newline at end of file
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
// 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 win
function createWindow () {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600})
// and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
// Open the DevTools.
win.webContents.openDevTools()
// Emitted when the window is closed.
win.on('closed', () => {
// 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.
win = 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', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
{
"name": "klasfd-desktop-app",
"version": "0.1.0",
"main": "main.js",
"devDependencies": {
"electron": "^1.6.10"
},
"dependencies": {
"klas-file-downloader": "^0.2.7"
}
}
No preview for this file type
This diff is collapsed. Click to expand it.
@font-face {
font-family:'BMDOHYEON';
src: url(/public/fonts/BMDOHYEON.ttf) format('truetype');
}
\ No newline at end of file
var functions = require('./functions');
exports.getLectureList = function (id, pw) {
console.log(id + " " + pw);
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
"name": "klas-file-downloader",
"version": "0.1.7",
"description": "Project that download lecture reference files from Klas",
"main": "index.js",
"main": "module.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
......@@ -22,7 +22,7 @@
"url": "https://github.com/sungjunyoung/klas-file-downloader/issues"
},
"bin": {
"klasFD": "./index.js"
"klasFD": "./global.js"
},
"homepage": "https://sungjunyoung.github.io",
"dependencies": {
......