Created
August 24, 2016 16:37
-
-
Save kobachi/101b2462630133ceb7312512f0907a07 to your computer and use it in GitHub Desktop.
Electron Twitter Client Sample
This file contains hidden or 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
"use strict"; | |
const Electron = require("electron"); | |
const open = require("open"); | |
var window; | |
Electron.app.on("ready", () => { | |
window = new Electron.BrowserWindow({ | |
width: 400, | |
height: 640, | |
useContentSize: true, | |
webPreferences: { | |
defaultFontFamily: "sansSerif", | |
defaultFontSize: 9, | |
defaultEncoding: "utf-8", | |
zoomFactor: 0.9 | |
} | |
}).on("closed", () => { | |
window = null; | |
}); | |
window.setMenu(null); | |
window.loadURL("https://mobile.twitter.com/"); | |
window.webContents.on('new-window', (e, url) => { | |
if (url.indexOf("https://mobile.twitter.com/") != 0) { | |
e.preventDefault(); | |
open(url); | |
} | |
}); | |
}).on("window-all-closed", () => { | |
Electron.app.quit(); | |
}); |
This file contains hidden or 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
{ | |
"name": "Twitter", | |
"version": "1.0.0", | |
"description": "Tiny Twitter Client", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"electron": ".\\node_modules\\electron-prebuilt\\dist\\electron.exe .", | |
"postinstall": "install-app-deps", | |
"pack": "build --dir", | |
"dist": "build" | |
}, | |
"author": "kobachi", | |
"license": "BSD", | |
"devDependencies": { | |
"electron-builder": "^5.30.0", | |
"electron-prebuilt": "^1.3.4" | |
}, | |
"dependencies": { | |
"open": "0.0.5" | |
}, | |
"build": { | |
"appId": "xyz.kobachi.twitter", | |
"app-category-type": "public.app-category.social-networking", | |
"win": { | |
"iconUrl": "https://twitter.com/favicon.ico" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment