Skip to content

Instantly share code, notes, and snippets.

@ded
Created June 29, 2011 04:09
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ded/1053078 to your computer and use it in GitHub Desktop.
Save ded/1053078 to your computer and use it in GitHub Desktop.
ender CLI example
<script src="ender.min.js"></script>
<script>
$.require('/js/core.min.js', 'core')
$.ready('core', function () {
$(document).ready(function () {
$('<p>hello world</p>').appendTo('body')
.bind('click', function (e) {
$.require('/js/ajax.min.js', function () {
$(e.target).css('position', 'relative')
.animate({
left: 500
})
})
})
})
})
</script>
$ ender build scriptjs
$ ender build domready qwery klass bean bonzo -o core
$ ender build morpheus reqwest -o ajax
@myroslav
Copy link

As far as I understood sequence is:

  • on page enter, core.min.js is being loaded
  • as soon as it loads and browser finished construction of page' DOM, paragraph is appended in the end of the page.
  • When user clicks on that paragraph, ajax.min.js is loaded
  • as soon as it loads, paragraph is animated 500px to the right

Am I correct that ajax.min.js is loaded only after click, and not on page load?

@ded
Copy link
Author

ded commented Jun 29, 2011

yep. you got it. I would just change point 1 to say page enter and not page load.

@myroslav
Copy link

Thanks, I've updated my comment to be more correct for future reader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment