Controllers - globules-io/OGX.JS GitHub Wiki

In OGX.JS, controllers are objects that are used to handle the interactions between views. If you app becomes too big to have the Stage or a View act as the main controller, you can use additional controllers.

In the same fashion than views, controllers must respect a certain format, such as

 OGX.Controllers.NAME_OF_YOUR_CONTROLLER = function(){
      construct(this, 'Controllers.NAME_OF_YOUR_CONTROLLER ');
      'use strict';      
       
      this.construct = function(){
      };
 };

You can create this file with the CLI by typing

 ogx create controller NAME_OF_YOUR_CONTROLLER

Then you can retrieve the objects you need by looking them up

 OGX.Controllers.NAME_OF_YOUR_CONTROLLER = function(){
      construct(this, 'Controllers.NAME_OF_YOUR_CONTROLLER ');
      'use strict';    

       let list;  
       
      this.construct = function(){
           list = app.find('DynamicList', 'mylist');
           //or
           list = app.cfind('DynamicList', 'mylist');               
      };
 };

find will lookup going down the tree starting at the uxi you call it from

cfind will lookup in the global object cache