removed webassembly as required dependency

canary
WolverinDEV 2019-02-16 11:37:10 +01:00
parent fa30d3d055
commit 050b34129b
2 changed files with 30 additions and 0 deletions

View File

@ -575,6 +575,7 @@ const loader_javascript = {
const loader_webassembly = { const loader_webassembly = {
test_webassembly: async () => { test_webassembly: async () => {
/* We dont required WebAssembly anymore for fundamental functions, only for auto decoding
if(typeof (WebAssembly) === "undefined" || typeof (WebAssembly.compile) === "undefined") { if(typeof (WebAssembly) === "undefined" || typeof (WebAssembly.compile) === "undefined") {
console.log(navigator.browserSpecs); console.log(navigator.browserSpecs);
if (navigator.browserSpecs.name == 'Safari') { if (navigator.browserSpecs.name == 'Safari') {
@ -589,6 +590,7 @@ const loader_webassembly = {
displayCriticalError("You require WebAssembly for TeaSpeak-Web!"); displayCriticalError("You require WebAssembly for TeaSpeak-Web!");
throw "Missing web assembly"; throw "Missing web assembly";
} }
*/
} }
}; };

View File

@ -29,6 +29,32 @@ namespace log {
[LogCategory.I18N, "I18N "] [LogCategory.I18N, "I18N "]
]); ]);
let enabled_mapping = new Map<number, boolean>([
[LogCategory.CHANNEL, true],
[LogCategory.CLIENT, true],
[LogCategory.SERVER, true],
[LogCategory.PERMISSIONS, true],
[LogCategory.GENERAL, true],
[LogCategory.NETWORKING, true],
[LogCategory.VOICE, true],
[LogCategory.I18N, true]
]);
loader.register_task(loader.Stage.LOADED, {
name: "log enabled initialisation",
function: async () => initialize(),
priority: 10
});
//Example: <url>?log.i18n.enabled=0
export function initialize() {
for(const category of Object.keys(LogCategory).map(e => parseInt(e))) {
if(isNaN(category)) continue;
const category_name = LogCategory[category];
enabled_mapping[category] = settings.static_global("log." + category_name.toLowerCase() + ".enabled", true);
}
}
function logDirect(type: LogType, message: string, ...optionalParams: any[]) { function logDirect(type: LogType, message: string, ...optionalParams: any[]) {
switch (type) { switch (type) {
case LogType.TRACE: case LogType.TRACE:
@ -49,6 +75,8 @@ namespace log {
} }
export function log(type: LogType, category: LogCategory, message: string, ...optionalParams: any[]) { export function log(type: LogType, category: LogCategory, message: string, ...optionalParams: any[]) {
if(!enabled_mapping[category]) return;
optionalParams.unshift(category_mapping.get(category)); optionalParams.unshift(category_mapping.get(category));
message = "[%s] " + message; message = "[%s] " + message;
logDirect(type, message, ...optionalParams); logDirect(type, message, ...optionalParams);