The readystate is a pre-constructed ReadyState instance which exposes
various of methods to check and listen to readystate changes. Before
continuing with the API here is a list of the ready state's that we currently
support:
ALL: The I don't really give a fuck state.
UNKNOWN: We got an unknown readyState we should start listening for events.
LOADING: Environment is currently loading.
INTERACTIVE: Environment is ready for interaction.
COMPLETE: All resources have been loaded.
The INTERACTIVE state can be used for DOM ready and the COMPLETE for load
events.
readystate#is
The is method allows you check if a certain readystate has been reached. It
is not a strict check but a minimum check. For example if you want to know if
the LOADING state has been reached but your document is already in the
COMPLETE state we will return true.
// assume that document is fully loaded, these will all return true.readystate.is('loading');readystate.is('LOADING');readystate.is(readystate.LOADING);// assume that document is in `loading` state, these will return falsereadystate.is('interactive');readystate.is('INTERACTIVE');readystate.is(readystate.COMPLETE);
readystate#{state}
We also you to assign callback for when a certain readystate is reached. If
the state has yet to be reached we will queue your callback until the state is
reached. If we are already in that state we will immediately call the supplied
callback.