[ 3 posts ]

hame25

  • Joined: Thu Apr 26, 2012 5:34 am
  • Posts: 35
  • Offline
  • Profile

Delay in YUI class

Post Posted: Fri Jun 15, 2012 3:41 am
+0-
Hi

I am in the process of migrating legacy javascript code into its YUI equivilant.

I currently have converted a base class into YUI and have legacy child classes that are inheriting this class.

I have found that despite the YUI parent class being referenced before the legacy child classes the code is actually be executed after - meaning the parent class is not avaiable for the child classes to extend.

I'm assuming that this is becuase the YUI class is still waiting for the dependency loader to load the required YUI files.

Is there a way to mitigate this, i.e. ensure the YUI class is excuted ahead of the legacy child classes, or delay all the scripts until the YUI files have been loaded via the dependency loader?


Thanks in advance

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: Delay in YUI class

Post Posted: Fri Jun 15, 2012 4:11 am
+0-
hame25 wrote:
I'm assuming that this is becuase the YUI class is still waiting for the dependency loader to load the required YUI files.

If your class is in a module and it has all its dependencies declared in its YUI_config entry, then your class will always have its dependencies ready unless one failed to load. If a module failed to load it's always logged in the console.

Could you post your YUI_config? It'd help a lot figuring out what the problem is.

hame25

  • Joined: Thu Apr 26, 2012 5:34 am
  • Posts: 35
  • Offline
  • Profile

Re: Delay in YUI class

Post Posted: Fri Jun 15, 2012 5:25 am
+0-
I think your right, actually just read the same thing in the cookbook.

One further question is that the I have inline legacy code within my html calling objects that inherit from the base class (written in yui)

e.g. new flyout.navigation() which extends a flyout class (now converted to YUI)

in time these will be replaced within my js files using y.on("available"

but for now how can I deal with such occurances, I am assuming that this will try to exectute before yui is ready.

Thanks again
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum