How to use the nw.gui function in nw

To help you get started, we’ve selected a few nw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oaprograms / lingo-player / app / js / app.js View on Github external
config: {
            dontPlayWordOnClick: false
        },

        // for auto-download subtitle buttons
        downloadSubBtnInfo1 : {text: 'Auto-download', 'class': 'btn-success'},
        downloadSubBtnInfo2 : {text: 'Auto-download', 'class': 'btn-success'}

};

//    $scope.player = document.getElementById('player');
    $scope.player = player;

    // word database
    $scope.db = database.openDatabase(gui);

    // plays word using google translate TTS (triggers click inside iframe)
    $scope.playWord = function(fromSubs, target){
        if(fromSubs && $scope.data.config.dontPlayWordOnClick) return;

        $timeout(function(){
            function triggerMouseEvent (node, eventType) {
                var clickEvent = document.createEvent ('MouseEvents');
                clickEvent.initEvent (eventType, true, true);
                node.dispatchEvent (clickEvent);
            }

            var targetNode = document.getElementById(target ? target : 'iframe')
                .contentDocument.getElementById('gt-src-listen');
            triggerMouseEvent (targetNode, "mouseover");
            triggerMouseEvent (targetNode, "mousedown");
github setpixel / storyboard-fountain / node-webkit-src / js / main.js View on Github external
restoreOnStartup(function(err) {
      windowState.init();
      gui.Window.get().focus();
      $(".nano").nanoScroller();
      updater.check(gui);
      if (err) {
        console.log('err on restore', err.toString());
        create(afterRestore);
      }
      else {
        var _checkDataPath = function(next) {
          checkDataPath(function(err, valid) {
            if (err || !valid) {
              var path = require('path');
              var filename = path.basename(sourceConfig.scriptPath);
              alert('The data directory for ' + filename + ' could not be found. Please locate it.');
              var chooser = $('#pick-data-path-input');
              var onChoose = function() {
                var path = chooser.val();
                if (path && path.length) {
                  setDataPath(path, true);
github jmdobry / RequelPro / src / client / js / app.js View on Github external
try {
  var gui = require('nw.gui');
  var win = gui.Window.get();

  win.showDevTools();

  win.y = window.screen.availTop;
  win.x = window.screen.availLeft;
  win.height = window.screen.availHeight;
  win.width = window.screen.availWidth;

  var RequelPro = angular.module('RequelPro', ['ui.router', 'templates-app', 'angular-data.DSCacheFactory', 'angular-data.DS']);

  RequelPro.value('gui', gui);
  RequelPro.value('win', win);
  RequelPro.value('mout', require('mout'));
  RequelPro.value('process', window.process);
  RequelPro.value('path', require('path'));
  RequelPro.value('Mousetrap', window.Mousetrap);
  RequelPro.value('NeDB', {});

  RequelPro.config(['$logProvider', '$stateProvider', 'DSProvider', function ($logProvider, $stateProvider, DSProvider) {
    console.log('Begin RequelPro.config()');

    $logProvider.debugEnabled(true);

    try {
      $stateProvider
        .state('new', {
          url: '/new',
github guerrerocarlos / TorrenTV / src / app / app.js View on Github external
var gui = require('nw.gui');
count()
var emitter = gui.Window.get();
count()
var chromecastjs = require('chromecast-js')
count()
var subtitles_server = new (require("subtitles-server"))()
count()
var srt2vtt2 = require('srt2vtt2')
count()
var scfs = new (require("simple-cors-file-server"))()
count()

console.log(process.cwd())

console.log(gui)
var currentVersion = gui.App.manifest.version

var path = require("path")
var execPath = path.dirname( process.execPath );
console.log(execPath)

count()

/*
var updater = require('nw-updater')({'channel':'beta', "currentVersion": currentVersion,'endpoint':'http://torrentv.github.io/update.json'})
updater.update()

updater.on("download", function(version){
    console.log("OH YEAH! going to download version "+version)
})
updater.on("installed", function(){