Mostly error catching, require *.plugin.js *.theme.css, better hooking
This commit is contained in:
Jiiks 2016-05-06 21:34:40 +03:00
parent 640f1a5930
commit 2689708b49
3 changed files with 511 additions and 391 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* BetterDiscordApp Utils and Helper functions
* Version: 1.4
* Version: 1.5
* Author: Jiiks | http://jiiks.net
* Date: 25/08/2015 - 09:19
* Last Updated: 20/04/2016
* Last Updated: 06/05/2016
* https://github.com/Jiiks/BetterDiscordApp
*/
@ -224,7 +224,7 @@ Utils.prototype.mkdirSync = function(path) {
}
};
Utils.prototype.try = function(func, attempts, attempt, message, success, err) {
Utils.prototype.attemptSync = function(func, attempts, attempt, message, success, err) {
var self = this;
attempt = attempt || 0;
attempt++;
@ -235,9 +235,8 @@ Utils.prototype.try = function(func, attempts, attempt, message, success, err) {
}
setTimeout(function() {
self.warn(message + ", retrying #" + attempt);
if(!func()) {
self.warn(message + ", retrying #" + attempt);
self.try(func, attempts, attempt, message, success, err);
return;
}
@ -246,6 +245,28 @@ Utils.prototype.try = function(func, attempts, attempt, message, success, err) {
}, 1000);
};
Utils.prototype.attempt = function(func, attempts, attempt, message, success, err) {
var self = this;
attempt = attempt || 0;
attempt++;
if(attempt > attempts) {
err();
return;
}
setTimeout(function() {
func(function(ok) {
if(!ok) {
self.warn(message + ", retrying #" + attempt);
self.try(func, attempts, attempt, message, success, err);
return;
}
success();
});
}, 1000);
};
Utils.prototype.openDir = function(path) {
switch(process.platform) {
case "win32":

View File

@ -23,7 +23,7 @@
"repo": "Jiiks",
"branch": null,
"beta": false,
"local": true,
"local": false,
"localServer": "http://localhost",
"version": "0.2.8",
"updater": null,