API Docs for: 3.10.3
Show:

File: event/js/event-ready.js

  1. /*
  2. * DOM event listener abstraction layer
  3. * @module event
  4. * @submodule event-base
  5. */
  6.  
  7. /**
  8. * The domready event fires at the moment the browser's DOM is
  9. * usable. In most cases, this is before images are fully
  10. * downloaded, allowing you to provide a more responsive user
  11. * interface.
  12. *
  13. * In YUI 3, domready subscribers will be notified immediately if
  14. * that moment has already passed when the subscription is created.
  15. *
  16. * One exception is if the yui.js file is dynamically injected into
  17. * the page. If this is done, you must tell the YUI instance that
  18. * you did this in order for DOMReady (and window load events) to
  19. * fire normally. That configuration option is 'injected' -- set
  20. * it to true if the yui.js script is not included inline.
  21. *
  22. * This method is part of the 'event-ready' module, which is a
  23. * submodule of 'event'.
  24. *
  25. * @event domready
  26. * @for YUI
  27. */
  28. Y.publish('domready', {
  29. fireOnce: true,
  30. async: true
  31. });
  32.  
  33. if (YUI.Env.DOMReady) {
  34. Y.fire('domready');
  35. } else {
  36. Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready');
  37. }
  38.  
  39.