Skip to content

Instantly share code, notes, and snippets.

@suisho
Created May 20, 2013 14:10
Show Gist options
  • Save suisho/5612485 to your computer and use it in GitHub Desktop.
Save suisho/5612485 to your computer and use it in GitHub Desktop.
node-chromeを縮小したサンプル書きかけ
var defaultPath = function(){
}
var spawn = require('child_process').spawn;
var http = require('http');
var url = require('url');
var fs = require('fs');
var path = require('path');
module.exports = function(opts) {
var appUrl = opts.url || null;
if(!appUrl){
appUrl = "http://" + (opts.host || "localhost") + ':'+ (opts.port || 8080) + opts.index;
}
var dataDir = path.join(__dirname, "data-dir")
var args = [
'--app=' + appUrl,
'--force-app-mode',
'--app-window-size=' + (opts.width || 1024) + ',' + (opts.height || 760),
'--enable-crxless-web-apps',
'--user-data-dir=' + dataDir
];
var chrome;
chrome = spawn(opts.runtime, args);
return chrome;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment