examples/lib/timeline/timeline.js
function load (url, callback, sendCallbackWhenAlreadyLoaded) {
        if (sendCallbackWhenAlreadyLoaded == undefined) {
            sendCallbackWhenAlreadyLoaded = true;
        }

        if (isLoaded(url)) {
            if (sendCallbackWhenAlreadyLoaded) {
                callback(url);
            }
            return;
        }

        if (isLoading(url) && !sendCallbackWhenAlreadyLoaded) {
            return;
        }

        var c = callbacks[url];
        if (!c) {
            var image = new Image();
            image.src = url;

            c = [];
            callbacks[url] = c;

            image.onload = function (event) {
                urls[url] = true;
                delete callbacks[url];

                for (var i = 0; i < c.length; i++) {
                    c[i](url);
                }
            }
        }

        if (c.indexOf(callback) == -1) {
            c.push(callback);
        }
    }
function load (url, callback, sendCallbackWhenAlreadyLoaded) {
        if (sendCallbackWhenAlreadyLoaded == undefined) {
            sendCallbackWhenAlreadyLoaded = true;
        }

        if (isLoaded(url)) {
            if (sendCallbackWhenAlreadyLoaded) {
                callback(url);
            }
            return;
        }

        if (isLoading(url) && !sendCallbackWhenAlreadyLoaded) {
            return;
        }

        var c = callbacks[url];
        if (!c) {
            var image = new Image();
            image.src = url;

            c = [];
            callbacks[url] = c;

            image.onload = function (event) {
                urls[url] = true;
                delete callbacks[url];

                for (var i = 0; i < c.length; i++) {
                    c[i](url);
                }
            }
        }

        if (c.indexOf(callback) == -1) {
            c.push(callback);
        }
    }
function load ( url , callback , sendCallbackWhenAlreadyLoaded ) { if ( sendCallbackWhenAlreadyLoaded == undefined ) { sendCallbackWhenAlreadyLoaded = true ; } if ( isLoaded ( url ) ) { if ( sendCallbackWhenAlreadyLoaded ) { callback ( url ) ; } return ; } if ( isLoading ( url ) && ! sendCallbackWhenAlreadyLoaded ) { return ; } var c = callbacks [ url ] ; if ( ! c ) { var image = new Image ( ) ; image . src = url ; c = [ ] ; callbacks [ url ] = c ; image . onload = function ( event ) { urls [ url ] = true ; delete callbacks [ url ] ; for ( var i = 0 ; i < c . length ; i ++ ) { c [ i ] ( url ) ; } } } if ( c . indexOf ( callback ) == - 1 ) { c . push ( callback ) ; } }
Load given image url
@param {String} url
@param {function} callback
@param {boolean} sendCallbackWhenAlreadyLoaded  optional
Load given image url