Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseSave(command: ParseSaveCommand) {
const injector = progressReporter(onProgress);
try {
const save = parseSaveGame(command.data, injector);
postMessage(parseSaveSuccess(save));
} catch (e) {
postMessage(parseSaveError(e));
}
}
function doLoad(data: LoadCommandData) {
try {
const saveGame = parseSaveGame(data.buffer);
const msg: DataLoadedEvent = {
type: "loaded",
saveGame: saveGame
};
postMessage(msg);
} catch (e) {
const msg: DataLoadedEvent = {
type: "loaded",
error: e,
saveGame: null
};
postMessage(msg);
}
}
function parseSave(command: ParseSaveCommand) {
const injector = progressReporter(onProgress);
try {
const save = parseSaveGame(command.data, injector);
postMessage(parseSaveSuccess(save));
} catch (e) {
postMessage(parseSaveError(e));
}
}