Message from JavaScript discussions

April 2019

— And you would instantiate like so:

new Game(new SaveData('data/save.json'));

— 

Within Game:

constructor(saveData) {
this.saveData = saveData;
}

addToInventory(item) {
this.inventory.push(item);
// the object should probably be replaced by this.getData() or something, which would produce an object containing all data to be saved
this.saveData.save({ inventory: this.inventory });
}

— And you could save less often if you wished (instead of at every change)

— Suggest a good website project.

— All of this is clearly out of my league TRGWII 😂

— Heh

— I need to think on it for a while

— Where is this app gonna run?

— It will affect how and where you save to

— This is just for training purposes

— I want to try to make something like this work, that's it

— How to create single instance of database in node ha