MCPcopy Index your code
hub / github.com/KilledByAPixel/LittleJS / writeSaveData

Function writeSaveData

src/engineUtilities.js:220–226  ·  view source on GitHub ↗

Write save data to local storage * @param {string} saveName - unique name for the game/save * @param {Object} saveData - object containing data to be saved * @memberof Utilities

(saveName, saveData)

Source from the content-addressed store, hash-verified

218 * @param {Object} saveData - object containing data to be saved
219 * @memberof Utilities */
220function writeSaveData(saveName, saveData)
221{
222 ASSERT(isStringLike(saveName), 'saveData requires saveName string');
223 // tolerate localStorage being unavailable or quota exceeded
224 try { localStorage[saveName] = JSON.stringify(saveData); }
225 catch { LOG('writeSaveData: failed to write', saveName); }
226}
227
228///////////////////////////////////////////////////////////////////////////////
229

Callers

nothing calls this directly

Calls 3

isStringLikeFunction · 0.85
ASSERTFunction · 0.70
LOGFunction · 0.70

Tested by

no test coverage detected