Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>@Charles, there are 3 registration processes in mojito (yes, it is confusing at first):</p> <ul> <li>Affinity (server, client or common).</li> <li>YUI.add when creating yui modules (controllers, models, binders, etc)</li> <li>and the less common which is the registration by name (which includes soemthing that we call selectors)</li> </ul> <p>In your case, by having two controllers, one of them with a custom selector named "foo", you are effectible putting in use the 3 registration at once. Here is what happen internally:</p> <ul> <li>A controller is always detonated as "controller" filename from the mojit folder, which is part of the registration by name, and since you have "foo" selector for one of the controller, your mojit will have to modes, "default" and "foo". Which one of them will be use? depends on the application.json, where you can have some conditions to set the value of "selector", which by default is empty. If you set the value of selector to "foo" when, for example, device is an iphone, then that controller will be used when that condition matches.</li> <li>Then the <code>YUI.add</code> plays an important role, it is the way we can identify which controller should be used, and its only requirement is that NO OTHER MODULE in the app can have the same YUI Module name, which means that your controllers can't be named the same when registering them thru <code>YUI.add</code>. And I'm sure this is what is happening in your case. If they both have the same name under <code>YUI.add()</code> one will always override the other, and you should probably see that in the logs as a warning, if not, feel free to open an issue thru github.</li> </ul> <p>To summarize:</p> <ul> <li>The names used when registering YUI modules have to be unique, in your case, you can use: <code>YUI.add('MyMojit', function(){})</code> and <code>YUI.add('MyMojitFoo', function(){})</code>, for each controller.</li> <li>Use the selector (e.g.: controller.server-mobile.js) to select which YUI module should be used for a particular request by setting <code>selector</code> to the proper value in <code>application.json</code>.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload