drnextgis
drnextgis

Reputation: 2224

Dojo parseOnLoad doesn't work

I'm using custom build with included dojo/parser and dojoConfig option parseOnLoad: true in HTML page. But when my page is loaded - parsing is not triggered. I've found workaround: add to dojoConfig option deps: ["dojo/parser"]. But it is not clear for me why I should use it if dojo/parser is contained within my build.

Upvotes: 0

Views: 328

Answers (1)

Patrick Ruzand
Patrick Ruzand

Reputation: 475

The fact that a module is contained in a built layer does not mean it needs not to be required. Indeed, while a layer contents the code of the modules it includes, the modules themselves will be fully resolved (ie their factory function called) when they will be explicitly required. That's why the deps option solves your issue: it just a shortcuts to a require call.
So, to summarize: load your layer AND require the modules (as you would do for the non-built version)

(Note that in sync mode, the dojo/parser module is automatically required).

Upvotes: 2

Related Questions