YUI (page->requires->yui_module)

YUI (page->requires->yui_module)

by Richard O'flynn -
Number of replies: 3

Can any of the moodle developers explain to me why the requires->yui_module() function does not pass the YUI instance (Y) into the callback function?

i.e.

Y.use('xxx',function() {

// no access to 'Y' the YUI instance???

})

Thanks,

Average of ratings: -
In reply to Richard O'flynn

Re: YUI (page->requires->yui_module)

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, don't use $PAGE->requires->yui_module.

Use $PAGE->requires->js_init_call.

See, for example

http://cvs.moodle.org/moodle/mod/quiz/attempt.php?view=markup

http://cvs.moodle.org/moodle/mod/quiz/module.js?view=markup

In reply to Tim Hunt

Re: YUI (page->requires->yui_module)

by Richard O'flynn -

I know I have seen this function, but I was trying to follow the guidlines on:

http://docs.moodle.org/en/Development:How_to_create_a_YUI_3_module

It may seem like I'm nit picking, but I was partly curious as to why the Y arguement was omitted. I thought there might actually be a good reason?

Is there! smile

In reply to Richard O'flynn

Re: YUI (page->requires->yui_module)

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Interestingly, the first example on that page gets it right, then the others are wrong. I am too tired to work out how to fix it, so if you have got to the bottom of it, please update the wiki page.

Hopefully Sam Hemelryk, or Petr Skoda, who are the people that implemented most of this, will see this thread, and review any changes you make, or fix the page if you can't.