0.2.8
Mostly error catching, require *.plugin.js *.theme.css, better hooking
This commit is contained in:
parent
640f1a5930
commit
2689708b49
File diff suppressed because it is too large
Load Diff
31
lib/Utils.js
31
lib/Utils.js
|
@ -1,8 +1,8 @@
|
||||||
/* BetterDiscordApp Utils and Helper functions
|
/* BetterDiscordApp Utils and Helper functions
|
||||||
* Version: 1.4
|
* Version: 1.5
|
||||||
* Author: Jiiks | http://jiiks.net
|
* Author: Jiiks | http://jiiks.net
|
||||||
* Date: 25/08/2015 - 09:19
|
* Date: 25/08/2015 - 09:19
|
||||||
* Last Updated: 20/04/2016
|
* Last Updated: 06/05/2016
|
||||||
* https://github.com/Jiiks/BetterDiscordApp
|
* 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;
|
var self = this;
|
||||||
attempt = attempt || 0;
|
attempt = attempt || 0;
|
||||||
attempt++;
|
attempt++;
|
||||||
|
@ -235,9 +235,8 @@ Utils.prototype.try = function(func, attempts, attempt, message, success, err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
self.warn(message + ", retrying #" + attempt);
|
|
||||||
|
|
||||||
if(!func()) {
|
if(!func()) {
|
||||||
|
self.warn(message + ", retrying #" + attempt);
|
||||||
self.try(func, attempts, attempt, message, success, err);
|
self.try(func, attempts, attempt, message, success, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -246,6 +245,28 @@ Utils.prototype.try = function(func, attempts, attempt, message, success, err) {
|
||||||
}, 1000);
|
}, 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) {
|
Utils.prototype.openDir = function(path) {
|
||||||
switch(process.platform) {
|
switch(process.platform) {
|
||||||
case "win32":
|
case "win32":
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"repo": "Jiiks",
|
"repo": "Jiiks",
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"beta": false,
|
"beta": false,
|
||||||
"local": true,
|
"local": false,
|
||||||
"localServer": "http://localhost",
|
"localServer": "http://localhost",
|
||||||
"version": "0.2.8",
|
"version": "0.2.8",
|
||||||
"updater": null,
|
"updater": null,
|
||||||
|
|
Loading…
Reference in New Issue