Skip to content

Make a helper method for getting a file's localStorage object #85

Closed
OscarGodson opened this Issue May 1, 2012 · 3 comments

2 participants

@OscarGodson
Owner

Tired of writing:

JSON.parse(localStorage[self.settings.localStorageName]).file[self.settings.file.name];

Would rather write:

// Returns `JSON.parse(localStorage[self.settings.localStorageName])`
self.files();

//Returns `JSON.parse(localStorage[self.settings.localStorageName]).file[NAME]`
self.files(self.settings.file.name);

This should also be a public API method so devs can get files out without affecting the GUI.

@OscarGodson OscarGodson was assigned Jun 18, 2012
@OscarGodson
Owner

@johnmdonahue This is done and working, just have to write tests, but the naming part is the hardest. I went with fileList([name]). How do you feel about that? I wanted to do file or files but that felt like you should be able to do more with it like import and export. I was thinking about the Node and thought of fs, but too vague. Any other ideas?

@OscarGodson
Owner

Think it should maybe be getFiles() to match getElements() and the fact we have a sort of actionNoun thing going too with importFile, exportFile, getElements, etc.

@johnmdonahue
Collaborator

Late to the party but +1 on getFiles()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.