Невозможно получить обработчик для nw, чтобы добавить код в nw. js - PullRequest
0 голосов
/ 13 февраля 2020

Я хочу установить прокси перед выполнением запроса на URL. Я просмотрел документы и нашел https://nwjs.readthedocs.io/en/latest/References/App/#appsetproxyconfigconfig -pac_url , но я не знаю, как получить ссылку на «Приложение». Пожалуйста, смотрите код ниже, и любая помощь будет высоко оценена. Я пытался [var nw = require ('nw');] , но не повезло.

    var gui = require('nw.gui'); 

    // Get the current window
    var win = gui.Window.get();

    // Listen to the minimize event
    win.on('minimize', function() {
      console.log('Window is minimized');
    });

    var nw = require('nw');
    nw.App.setProxyConfig('proxy_url');

    // Create a new window and get it
    var new_win = gui.Window.open('some_url');

    // And listen to new window's focus event
    new_win.on('focus', function() {
      console.log('New window is focused');
    });
...