Skip to content

Commit

Permalink
Ticket #85 - Renamed fileList to getFiles to match other API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarGodson committed Jun 22, 2012
1 parent 77925d9 commit cde266a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ removeFileBtn.onclick = function () {
}
```

### fileList([_name_])
### getFiles([_name_])

If no `name` is given it returns an object containing all the file objects. If a `name` is specified it will return just that single file object.

```javascript
var files = editor.fileList();
var files = editor.getFiles();
for (x in files) {
console.log('File: ' + x); //Returns the name of each file
};
Expand Down
12 changes: 6 additions & 6 deletions epiceditor/js/epiceditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@
defaultStorage = JSON.stringify(defaultStorage);
localStorage[self.settings.localStorageName] = defaultStorage;
}
else if (self.fileList(self.settings.file.name) === undefined) {
_defaultFile = self.fileList(self.settings.file.name);
else if (self.getFiles(self.settings.file.name) === undefined) {
_defaultFile = self.getFiles(self.settings.file.name);
_defaultFile = self._defaultFileSchema();
_defaultFile.content = self.settings.file.defaultContent;
}
Expand Down Expand Up @@ -965,7 +965,7 @@
name = name || self.settings.file.name;
self.settings.file.name = name;
if (localStorage && localStorage[self.settings.localStorageName]) {
fileObj = self.fileList();
fileObj = self.getFiles();
if (fileObj[name] !== undefined) {
_setText(self.editor, fileObj[name].content);
self.emit('read');
Expand Down Expand Up @@ -1105,7 +1105,7 @@
name = name || self.settings.file.name;
kind = kind || 'text';

file = self.fileList(name);
file = self.getFiles(name);

// If the file doesn't exist just return early with undefined
if (file === undefined) {
Expand All @@ -1129,7 +1129,7 @@
}
}

EpicEditor.prototype.fileList = function (name) {
EpicEditor.prototype.getFiles = function (name) {
var files = JSON.parse(localStorage[this.settings.localStorageName]);
if (name) {
return files[name];
Expand Down Expand Up @@ -1166,7 +1166,7 @@
var self = this
, x;

data = data || self.fileList(self.settings.file.name);
data = data || self.getFiles(self.settings.file.name);

if (!this.events[ev]) {
return;
Expand Down
Loading

0 comments on commit cde266a

Please # to comment.