RAD.js is a framework that allows to build
mobile applications faster.
Optimized for iOS, Android, and
Windows Phone 8, as well as supporting all
major Web browsers.

View on GitHub Download

Q?

How can I find out what views are visible on the screen?

A.

querySelectorAll(«[view]»);

Q?

How can I get the link to the HTML-element-container, which contains the view?

A.

querySelector(«[view='viewID']»);

Q?

How can I get the list of all instantiated views?

A.

RAD.core.getStartedViews();
Fortunately (or not) we had no real necessity to call this method.

Q?

How can I get the instance of any application module?

A.

In any application part it is possible to get a direct link to any registered application module (view or service) through a direct link to the core:


RAD.core.getView(viewID, extras);
RAD.core.getService(viewID);

Please consider that architecture of a RAD.js application presupposes weak coherence of modules and dynamic creation and elimination of application parts; that is why it is not recommended to use this mechanism.
It is so because these methods will return to you a link to an instance of an already existing module with indicated ID, or will create a new one. If you save this link, for example, in the attribute of your view, some other part of your application, again through methods of the core, can delete a module instance, then instantiate it with other data or model.
As a result there will be strong coherence and a link to the module that is already eliminated and is not used anywhere. It could be recommended to use methods of the core only in the application object. Thus all the work of creating and eliminating modules will be centralized in one place, and it will be easier to detect logical errors.

Q?

Can modules be considered as Backbone.View?

A.

No, but they are based on Backbone.View and have similar tasks, the main of them is displaying the module on the page.

Q?

What is channel? Does every module have its own channel? How are subscribe and publish in a particular channel executed? There is a message published in the channel; must the module listening to the channel and waiting for this message react to it?

A.

Channel consists of a publisher, a subscriber module and a mediator. The messages that these components exchange are events (”commands”, ”intentions”).

Q?

What is extras?

A.

Additional data transferred to view during publishing a message through navigator.

Q?

To which messages are modules subscribed during registration?

A.

To events, names of which start with “view.” + module name. Upon publishing such a message, onReceiveMsg of this module is called.

Q?

What is backstack? How does it work and what options must be set for its correct work?

A.

It is a component of the router plugin, which allows to dynamically memorize layout of views on the screen for a particular session, using browser’s history API or internal realization; thus it allows to return to previous positions of modules.

To use backstack, it is enough to indicate the parameter backstack: true in view change query. For further details ref. backstack.

Q?

Will animation of child modules work, if set this way?

A.

  
RRAD.views.ParentWidget = RAD.Blanks.View.extend({
    url:'source/views/parent_widget/parent_widget.html',
    children: [
        {
            container_id: '.content',
            content: "view.inner_first_widget",
            animation: 'slide'
		},
        {
            container_id: '.top',
            content: "view.inner_third_widget",
            animation: 'fade'
        }
    ]
});

Yes, but it should not be used this way because it won’t look good visually.

Q?

What happens to child modules during rendering of the parent module?

A.

During the very first rendering of the parent module the following happens:

Callback onStartRender() (if defined);
Rendering of the module;
Attachment of child modules;
Callback onEndRender() (if defined).
During the repeated rendering, pre-detachment of child modules is added to order of actions:

Thus only the parent module is rerendered, while child modules are not.

Callback onStartRender() (if defined);
Detachment of child modules;
Rendering of the module;
Attachment of child modules;
Callback onEndRender() (if defined).

Q?

Can iScroll be attached to a child HTML-element of a module during display of this module?

A.

Yes, you must indicate the “scroll-view” class for the iScroll container.

Q?

What iScroll events are there?

A.

Ref. iScroll4 documentation.