-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add function to suggest untitled document name #89
Conversation
function _getUntitledFileSuggestion( dir, baseFileName, fileExt ) { | ||
var suggestedName = baseFileName + fileExt; | ||
var dirEntry = new NativeFileSystem.DirectoryEntry(dir); | ||
var result = $.Deferred(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, we should use new with $.Deferred() (it isn't necessary, but does make the code a bit easier to read).
The async code looks good, but it feels a bit odd putting it in ProjectManager like that. How about doing this async implementation, but back in FileCommandHandlers. The call to ProjectManager.createNewItem() would be made in the done() handler. |
If I call ProjectManager.createNewItem() in my done handler, how do I return the results to the caller of handleFileNewInProject? |
You would need to add a new Deferred in handleFileNewInProject, and return that. The new Deferred would resolve()/reject() based on the result of the Deferred returned from ProjectManager.createNewItem(). Asynchronous coding at it's finest :-) |
Should be ready to roll |
Add function to suggest untitled document name
Fix adobe#45 Removed unneccessary connection messages
Fix adobe#45 Removed unneccessary connection messages
Fix adobe#45 Removed unneccessary connection messages
Fix adobe#45 Removed unneccessary connection messages
Fix adobe#45 Removed unneccessary connection messages
Fix adobe#45 Removed unneccessary connection messages
Fix adobe#45 Removed unneccessary connection messages
This is to fix #26