asual/jquery-address — Issue #108: 'change' event fires on initialization only if registered before initialization
Author: eleith
Created: 2011-10-15 17:31:28+00:00
State: open

for me, most of the time, 'change' will get fired when jquery-address gets initialized. (i load all my scripts at the bottom of the page).

i take advantage of this first initial change trigger to check what the current URL is.

however, when i changed my scripts to load async, i realize that if my change binding got registered after jquery-address was initialized, i would miss out on the first change event being fired.

i want some consistency in when the change event gets fired

i have a few options

1. check each time i register the change event, if jquery-address is already initialized, trigger my callback manually, otherwise jquery-address will do it for me
2. have jquery-address not fire a change event on initialization, and i always run my callback manually
3. have jquery-address fire a change event if one is registered but jquery-address is already initialized

i went with number three in my fork here 40690896851448c3b4edd4a21a7966230bf0f30c

i like this solution better, since i can rely on jquery-address to do the work for me, without having to write extra logic in my other scripts