public/javascripts/yui/history/history-debug.js
function (module, initialState, onStateChange, obj, overrideContext) {

            var scope, wrappedFn;

            if (typeof module !== "string" || YAHOO.lang.trim(module) === "" ||
                typeof initialState !== "string" ||
                typeof onStateChange !== "function") {
                throw new Error("Missing or invalid argument");
            }

            if (_modules[module]) {
                // Here, we used to throw an exception. However, users have
                // complained about this behavior, so we now just return.
                return;
            }

            // Note: A module CANNOT be registered after calling
            // YAHOO.util.History.initialize. Indeed, we set the initial state
            // of each registered module in YAHOO.util.History.initialize.
            // If you could register a module after initializing the Browser
            // History Manager, you would not read the correct state using
            // YAHOO.util.History.getCurrentState when coming back to the
            // page using the back button.
            if (_initialized) {
                throw new Error("All modules must be registered before calling YAHOO.util.History.initialize");
            }

            // Make sure the strings passed in do not contain our separators "," and "|"
            module = escape(module);
            initialState = escape(initialState);

            // If the user chooses to override the scope, we use the
            // custom object passed in as the execution scope.
            scope = null;
            if (overrideContext === true) {
                scope = obj;
            } else {
                scope = overrideContext;
            }

            wrappedFn = function (state) {
                return onStateChange.call(scope, state, obj);
            };

            _modules[module] = {
                name: module,
                initialState: initialState,
                currentState: initialState,
                onStateChange: wrappedFn
            };
        }
function (module, initialState, onStateChange, obj, overrideContext) {

            var scope, wrappedFn;

            if (typeof module !== "string" || YAHOO.lang.trim(module) === "" ||
                typeof initialState !== "string" ||
                typeof onStateChange !== "function") {
                throw new Error("Missing or invalid argument");
            }

            if (_modules[module]) {
                // Here, we used to throw an exception. However, users have
                // complained about this behavior, so we now just return.
                return;
            }

            // Note: A module CANNOT be registered after calling
            // YAHOO.util.History.initialize. Indeed, we set the initial state
            // of each registered module in YAHOO.util.History.initialize.
            // If you could register a module after initializing the Browser
            // History Manager, you would not read the correct state using
            // YAHOO.util.History.getCurrentState when coming back to the
            // page using the back button.
            if (_initialized) {
                throw new Error("All modules must be registered before calling YAHOO.util.History.initialize");
            }

            // Make sure the strings passed in do not contain our separators "," and "|"
            module = escape(module);
            initialState = escape(initialState);

            // If the user chooses to override the scope, we use the
            // custom object passed in as the execution scope.
            scope = null;
            if (overrideContext === true) {
                scope = obj;
            } else {
                scope = overrideContext;
            }

            wrappedFn = function (state) {
                return onStateChange.call(scope, state, obj);
            };

            _modules[module] = {
                name: module,
                initialState: initialState,
                currentState: initialState,
                onStateChange: wrappedFn
            };
        }
function ( module , initialState , onStateChange , obj , overrideContext ) { var scope , wrappedFn ; if ( typeof module !== "string" || YAHOO . lang . trim ( module ) === "" || typeof initialState !== "string" || typeof onStateChange !== "function" ) { throw new Error ( "Missing or invalid argument" ) ; } if ( _modules [ module ] ) { // Here, we used to throw an exception. However, users have // complained about this behavior, so we now just return. return ; } // Note: A module CANNOT be registered after calling // YAHOO.util.History.initialize. Indeed, we set the initial state // of each registered module in YAHOO.util.History.initialize. // If you could register a module after initializing the Browser // History Manager, you would not read the correct state using // YAHOO.util.History.getCurrentState when coming back to the // page using the back button. if ( _initialized ) { throw new Error ( "All modules must be registered before calling YAHOO.util.History.initialize" ) ; } // Make sure the strings passed in do not contain our separators "," and "|" module = escape ( module ) ; initialState = escape ( initialState ) ; // If the user chooses to override the scope, we use the // custom object passed in as the execution scope. scope = null ; if ( overrideContext === true ) { scope = obj ; } else { scope = overrideContext ; } wrappedFn = function ( state ) { return onStateChange . call ( scope , state , obj ) ; } ; _modules [ module ] = { name : module , initialState : initialState , currentState : initialState , onStateChange : wrappedFn } ; }
Registers a new module.

@method register
@param {string} module Non-empty string uniquely identifying the
module you wish to register.
@param {string} initialState The initial state of the specified
module corresponding to its earliest history entry.
@param {function} onStateChange Callback called when the
state of the specified module has changed.
@param {object} obj An arbitrary object that will be passed as a
parameter to the handler.
@param {boolean} overrideContext If true, the obj passed in becomes the
execution scope of the listener.
Registers a new module .