Permalink
Browse files

improve readability

  • Loading branch information...
1 parent 740abcd commit bcc944fd378fd558a89e42e3bea530c5a9a14963 @thomasdao committed Aug 28, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 vm.js
View
14 vm.js
@@ -4,9 +4,9 @@ window.VM = window.VM || {};
// VM.views hold all references to existing views
VM.views = VM.views || {};
-// Close view
+// Close existing view
VM.closeView = function(name) {
- if (typeof VM.views[name] !== 'undefined') {
+ if ( typeof VM.views[name] !== 'undefined') {
// Cleanup view
// Remove all of the view's delegated events
VM.views[name].undelegateEvents();
@@ -15,7 +15,7 @@ VM.closeView = function(name) {
// Removes all callbacks on view
VM.views[name].off();
- if (typeof VM.views[name].close === 'function') {
+ if ( typeof VM.views[name].close === 'function') {
VM.views[name].close();
}
}
@@ -25,7 +25,7 @@ VM.closeView = function(name) {
// creating a new one.
// callback function always return a new view instance
VM.createView = function(name, callback) {
- VM.closeView(name);
+ VM.closeView(name);
VM.views[name] = callback();
return VM.views[name];
};
@@ -34,10 +34,10 @@ VM.createView = function(name, callback) {
// execute callback function to return new view
// callback function always return a new view instance
VM.reuseView = function(name, callback) {
- if (typeof VM.views[name] !== 'undefined') {
+ if ( typeof VM.views[name] !== 'undefined') {
return VM.views[name];
}
-
+
VM.views[name] = callback();
return VM.views[name];
-};
+};

0 comments on commit bcc944f

Please sign in to comment.