What is the main difference between require() and define() function in dojo and when would we use either?

require and define are part of the asynchronous module definition (AMD) API.

You use define to define a module that can be consumed by other code. Generally, define will be used in a javascript file. The javascript file is defining a module. All Dojo files use define.

You use require when you are not defining a module, but you require modules that have been defined. Generally, require will be used in HTML pages. The HTML page is not a module, but requires modules to present the page to the user.

AMD API

https://github.com/amdjs/amdjs-api/wiki/AMD

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)