lib/assets/javascripts/jax/mvc/controller.js in jax-3.0.0.rc1 vs lib/assets/javascripts/jax/mvc/controller.js in jax-3.0.0.rc2
- old
+ new
@@ -23,11 +23,11 @@
* * *mouse_released* - called when a mouse button has been released.
* * *mouse_clicked* - called when a mouse button has been clicked.
* * *key_pressed* - called when a keyboard button has been pressed.
* * *key_released* - called when a keyboard button has been released.
* * *key_typed* - called when a keyboard button has been typed.
- * * *update* - called (approximately) every 60 milliseconds for as long
+ * * *update* - called (approximately) 60 times per second for as long
* as a controller is active. Time difference in seconds is passed as an arguments.
*
* Example:
*
* var WelcomeController = Jax.Controller.Create("welcome", ApplicationController, {
@@ -45,12 +45,12 @@
* });
*
* With the exception of event actions, which will be fired every time an event occurs,
* controller actions are only triggered once for a given controller unless they
* explicitly trigger other actions by calling them directly. They differ from their
- * corresponding views (see Jax.View) in this way, as a view is rendered many times
- * -- up to a target rate of 60 passes per second.
+ * corresponding views in this way, as a view is rendered many times -- up to a
+ * target rate of 60 times per second.
*
**/
(function() {
var protected_instance_method_names = [
'initialize', 'toString', 'getControllerName', 'constructor', 'fireAction',
@@ -95,13 +95,16 @@
if (this[action_name])
this[action_name].call(this, []);
else throw new Error("Call to missing action: '"+action_name+"' in controller '"+this.getControllerName()+"'");
- if (!this.rendered_or_redirected)
+ if (!this.rendered_or_redirected) {
this.view_key = this.getControllerName()+"/"+this.action_name;
- this.view = Jax.views.find(this.view_key);
+ var newView = Jax.views.find(this.view_key);
+ if (newView)
+ this.view = newView;
this.rendered_or_redirected = true;
+ }
return this;
},
getControllerName: function() { return null; },