This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
/* H/T: | |
Avoiding Race Conditions and Memory Leaks in React useEffect | |
https://javascript.plainenglish.io/avoiding-race-conditions-and-memory-leaks-in-react-useeffect-2034b8a0a3c7 | |
*/ | |
interface IUseFetchWithAbortResponse { | |
fetchedData: unknown; | |
isLoading: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- load the JSON library. | |
local Json = require("json") | |
local JsonStorage = {} | |
-- Function to save a table. Since game settings need to be saved from session to session, we will | |
-- use the Documents Directory | |
JsonStorage.saveTable = function(t, filename) | |
local path = system.pathForFile( filename, system.DocumentsDirectory) | |
local file = io.open(path, "w") |