mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-13 11:15:51 +00:00
Refactoring (#27)
* chore: release version v1.3.1 * fix(Core): Add system "true security" correction * chore: release version v1.3.1
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import Mapper from './MapRoot';
|
||||
import { decompressToJson } from './utils';
|
||||
|
||||
export default {
|
||||
_rootEl: null,
|
||||
@@ -28,17 +27,12 @@ export default {
|
||||
|
||||
handleEventWrapper(event: string, handler: (payload: any) => void) {
|
||||
this.handleEvent(event, (body: any) => {
|
||||
if (event === 'map_event') {
|
||||
const { type, body: data } = body;
|
||||
handler({ type, body: decompressToJson(data) });
|
||||
} else {
|
||||
handler(body);
|
||||
}
|
||||
handler(body);
|
||||
});
|
||||
},
|
||||
|
||||
reconnected() {
|
||||
this.pushEvent('reconnected');
|
||||
this.pushEvent('ui_loaded');
|
||||
},
|
||||
|
||||
async pushEventAsync(event: string, payload: any) {
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import pako from 'pako';
|
||||
|
||||
export const decompressToJson = (base64string: string) => {
|
||||
const base64_decoded = atob(base64string);
|
||||
const charData = base64_decoded.split('').map(function (x) {
|
||||
return x.charCodeAt(0);
|
||||
});
|
||||
const zlibData = new Uint8Array(charData);
|
||||
const inflatedData = pako.inflate(zlibData, {
|
||||
to: 'string',
|
||||
});
|
||||
|
||||
return JSON.parse(inflatedData);
|
||||
};
|
||||
@@ -1,3 +1,2 @@
|
||||
export * from './contextStore';
|
||||
export * from './decompressToJson';
|
||||
export * from './getQueryVariable';
|
||||
|
||||
Reference in New Issue
Block a user