2016-09-21 3 views
0

Я работаю над настольным приложением, и мне нужно отключить автолаучер, если год 2018 для exp.узел webkit отключить autolauncher в год +1

var AutoLaunch = require('auto-launch'); 
var appLauncher = new AutoLaunch({ 
    name: 'app' 
}); 

appLauncher.isEnabled().then(function (enabled) { 
    if (enabled) 
     return; 
    return appLauncher.enable() 
}).then(function (err) { 
}); 

У вас есть идеи? :)
Благодаря

ответ

0

Мы можем отключить автоматический запуск в любое время с помощью:

appLauncher.disable(); 

Это полный код:

var today = new Date(); 
var year = today.getFullYear(); 
var AutoLaunch = require('auto-launch'); 
var appLauncher = new AutoLaunch({ 
    name: 'app', 
}); 

appLauncher.isEnabled().then(function (enabled) { 
    console.log("start ", enabled); 
    if (enabled && year > "2016") { 
     return appLauncher.disable(); 
    } 
    if (enabled) { 
     return; 
    } 
    return appLauncher.enable(); 

}).then(function (err) { 
}); 

Надеется, что это поможет :)

Смежные вопросы