Skip to content

Instantly share code, notes, and snippets.

@zenorocha
Last active March 15, 2018 00:01
Show Gist options
  • Save zenorocha/b93c68e7f9a706a7269b to your computer and use it in GitHub Desktop.
Save zenorocha/b93c68e7f9a706a7269b to your computer and use it in GitHub Desktop.
A.use vs A.ready
AUI().use('aui-button', function(A) {
   // This code will fire when
   // aui-button module and its
   // dependencies are loaded
});

Now, there are times when you want to both load some modules and fire your callback on DOM ready, so here is how you would do that in Alloy:

AUI().ready('aui-button', function(A){ 
   // This code will fire on DOM ready 
   // and when this module and its
   // dependencies are ready
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment