Skip to content

Instantly share code, notes, and snippets.

@kobachi
Created August 24, 2016 16:37
Show Gist options
  • Save kobachi/101b2462630133ceb7312512f0907a07 to your computer and use it in GitHub Desktop.
Save kobachi/101b2462630133ceb7312512f0907a07 to your computer and use it in GitHub Desktop.
Electron Twitter Client Sample
"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();
});
{
"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