Created
          May 20, 2013 14:10 
        
      - 
      
 - 
        
Save suisho/5612485 to your computer and use it in GitHub Desktop.  
    node-chromeを縮小したサンプル書きかけ
  
        
  
    
      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
    
  
  
    
  | 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