Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:JavaScript guidelines: Difference between revisions

From MoodleDocs
Line 12: Line 12:
== Some information on using YUI calls? ==
== Some information on using YUI calls? ==
Unless I've missed something, I can't see any information on how to use the YUI library in Moodle 2. It's not intuitively obvious either. --[[User:Howard Miller|Howard Miller]] 10:44, 8 February 2011 (UTC)
Unless I've missed something, I can't see any information on how to use the YUI library in Moodle 2. It's not intuitively obvious either. --[[User:Howard Miller|Howard Miller]] 10:44, 8 February 2011 (UTC)
== What does M.mod_mymod.init_something in general ==
What if my 'module' is a block or a report or some-such? What is the general syntax of this string? --[[User:Howard Miller|Howard Miller]] 11:20, 8 February 2011 (UTC)

Revision as of 11:20, 8 February 2011

event handlers

Should there be a recommendation to use YUI event handlers instead of JavaScript's inline event handlers? This might be better for cross-browser compatibility. --Frank Ralf 09:24, 15 June 2009 (UTC)

Good idea--Tim Hunt 03:16, 16 June 2009 (UTC)

Getting Moodle to load your JavaScript files

are in_head and asap now obsolete? It seems in_head is replaced by the second parameter to the js class constructor, is there an alternative for asap? --Alastair Hole 17:46, 13 June 2010 (UTC)

Yes. They are obsolete. If you want to output JS in the middle of the page, you should not just do that using the js_writer class. However, the only javascript like that should be simple function calls to initialise things. It is much better to have your javascript in the footer, and if you plan for that in advance, it is normally easy to do. (I will now update this page, to remove mention of obsolete stuff.)--Tim Hunt 19:27, 13 June 2010 (UTC)

Some information on using YUI calls?

Unless I've missed something, I can't see any information on how to use the YUI library in Moodle 2. It's not intuitively obvious either. --Howard Miller 10:44, 8 February 2011 (UTC)

What does M.mod_mymod.init_something in general

What if my 'module' is a block or a report or some-such? What is the general syntax of this string? --Howard Miller 11:20, 8 February 2011 (UTC)