XL v1.3.9
This commit is contained in:
parent
23bad1ff10
commit
cd52105f1a
|
@ -41,7 +41,7 @@ var XenoLib = (() => {
|
||||||
twitter_username: ''
|
twitter_username: ''
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
version: '1.3.8',
|
version: '1.3.9',
|
||||||
description: 'Simple library to complement plugins with shared code without lowering performance.',
|
description: 'Simple library to complement plugins with shared code without lowering performance.',
|
||||||
github: 'https://github.com/1Lighty',
|
github: 'https://github.com/1Lighty',
|
||||||
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js'
|
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js'
|
||||||
|
@ -123,11 +123,12 @@ var XenoLib = (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
XenoLib.getClass = arg => {
|
XenoLib.getClass = (arg, thrw) => {
|
||||||
try {
|
try {
|
||||||
const args = arg.split(' ');
|
const args = arg.split(' ');
|
||||||
return WebpackModules.getByProps(...args)[args[args.length - 1]];
|
return WebpackModules.getByProps(...args)[args[args.length - 1]];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (thrw) throw e;
|
||||||
if (!XenoLib.getClass.__warns[arg] || Date.now() - XenoLib.getClass.__warns[arg] > 1000 * 60) {
|
if (!XenoLib.getClass.__warns[arg] || Date.now() - XenoLib.getClass.__warns[arg] > 1000 * 60) {
|
||||||
Logger.stacktrace(`Failed to get class with props ${arg}`, e);
|
Logger.stacktrace(`Failed to get class with props ${arg}`, e);
|
||||||
XenoLib.getClass.__warns[arg] = Date.now();
|
XenoLib.getClass.__warns[arg] = Date.now();
|
||||||
|
@ -135,10 +136,11 @@ var XenoLib = (() => {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
XenoLib.getSingleClass = arg => {
|
XenoLib.getSingleClass = (arg, thrw) => {
|
||||||
try {
|
try {
|
||||||
return XenoLib.getClass(arg).split(' ')[0];
|
return XenoLib.getClass(arg).split(' ')[0];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (thrw) throw e;
|
||||||
if (!XenoLib.getSingleClass.__warns[arg] || Date.now() - XenoLib.getSingleClass.__warns[arg] > 1000 * 60) {
|
if (!XenoLib.getSingleClass.__warns[arg] || Date.now() - XenoLib.getSingleClass.__warns[arg] > 1000 * 60) {
|
||||||
Logger.stacktrace(`Failed to get class with props ${arg}`, e);
|
Logger.stacktrace(`Failed to get class with props ${arg}`, e);
|
||||||
XenoLib.getSingleClass.__warns[arg] = Date.now();
|
XenoLib.getSingleClass.__warns[arg] = Date.now();
|
||||||
|
|
Loading…
Reference in New Issue