Rearrange undefined callback check in On

The code, in the On function, that verifies that the provided callback is not `undefined` should be placed before accessing a property of the callback (in this case `target`).

The Pull Request also includes an update to the documentation to match the revised path of require.js in the demo (I didn't specifically want to re-include this commit, but it's still on my `master` branch, and still seems relevant).