740
Views
3
Comments
Required Scripts and OnApplicationReady
Question
Application Type
Reactive
Service Studio Version
11.12.2 (Build 50367)
Platform Version
11.13.0 (Build 31107)

In Reactive modules, do all scripts added to the module's Required Scripts load before the OnApplicationReady is fired? I've been getting intermittent errors where it seems the script hasn't run yet when I try to call it here.

Edit with more details:

The structure of our app looks like this:

PortalA (Reactive| End User/Home. Other similar modules like this, e.g. PortalB, PortalC)

  • Dependencies: PortalCore, Script_Lib
  • Module Required Scripts:
    • Script_Lib.Script1
    • Script_Lib.Script2
  • OnApplicationReady
    • Calls PortalCore.InitScriptLib

PortalCore (Reactive | Core. Has theme, layouts, web blocks, core Initialization actions)

  • Dependencies: Script_Lib
  • ClientActions: 
    • InitScriptLib (Public): Calls JS method from Script_Lib.Script1 with core configurations)

Script_Lib (Library | Foundation)

  • Scripts:
    • Script 1 (Public)
    • Script 2 (Public)
      • Requires Script1


2020-11-13 07-48-15
Khuong Truong

Hi Emma,

According to this On Application Ready Document:

As your description, I'm not sure that it is Home module or not.

Hope this helps,

Cheers,

Khuong


UserImage.jpg
Emma Thurlow

The OnApplicationReady event is in the Home module. I updated the description with more details on the module structure.

2021-02-18 12-29-06
António Pereira
Champion

Hi Emma,

In the event documentation you can also find "The On Application Ready action runs asynchronously, and doesn't block the render of the screens.". I assume that the Required Scripts have the same behaviour, i.e. they don't block the render of the app and the onApplicationReady execution.

Even though not entirely related with your issue but similar, in one of the projects I was involved in, I had a issue where I needed to call a JS lib (loaded in the OnApplicationReady event) in the OnReady event of the screen and it was raising the non defined exception. I had to implement a setTimeout to be constantly fired until the lib was initialized. Maybe you can use a similar approach.

Hope this somehow can help you.


Regards,

António Pereira

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.