JavaScript FAQ: Difference between revisions
From MoodleDocs
(New page: {{Moodle 2.0}} ; Why YUI? : The decision to use ''Yahoo! User Interface Library'' was done after a developer poll in 2006. Many core developers and contributors already learned how to use ...) |
No edit summary |
||
Line 6: | Line 6: | ||
; Why the global M? : It is problematic to set up global variables from code loaded through the YUI loader. There were also some function scoping problems. | ; Why the global M? : It is problematic to set up global variables from code loaded through the YUI loader. There were also some function scoping problems. | ||
; Why the strange namespace organisation in M? : It is easy to tell the namespace from plugin name and vice versa. This allowed us to implement some simple JS module autoloading. | |||
; Why the static ''init_'' methods in JS module ? : It is easy to guess how to use JS code from PHP. This should significantly improve readability of docs generated from the JS code. |
Revision as of 16:21, 27 January 2010
Moodle 2.0
- Why YUI?
- The decision to use Yahoo! User Interface Library was done after a developer poll in 2006. Many core developers and contributors already learned how to use it and it can not be replaced by something else easily. YUI 3 is significantly improved and should help us catch up with other more used frameworks such has JQuery.
- Can I use JQuery in my plugin?
- In theory yes, but you need to integrate it manually with Moodle which may create some unexpected problems.
- Why the global M?
- It is problematic to set up global variables from code loaded through the YUI loader. There were also some function scoping problems.
- Why the strange namespace organisation in M?
- It is easy to tell the namespace from plugin name and vice versa. This allowed us to implement some simple JS module autoloading.
- Why the static init_ methods in JS module ?
- It is easy to guess how to use JS code from PHP. This should significantly improve readability of docs generated from the JS code.