This project is archived and is in readonly mode.

#177 ✓duplicate
Jan Kassens

Rework Asset

Reported by Jan Kassens | June 30th, 2008 @ 08:25 AM

Unify the API for Assets and check for cross browser compatibility. 'onerror' 'onload' are confusing. I'd suggest to use proper events.

During that browser compatibility should be checked, as there were multiple complains (probably just because of the naming of their handlers).

Comments and changes to this ticket

  • Aaron Newton

    Aaron Newton February 19th, 2009 @ 12:27 AM

    • Assigned user changed from “Jan Kassens” to “Aaron Newton”
    • Milestone cleared.
  • Chris the Developer

    Chris the Developer February 26th, 2009 @ 10:35 AM

    I have been fiddling with a class architecture for this: http://code.google.com/p/mootool...

    Perhaps it's helpful, and feedback is most welcome.

  • Aaron Newton

    Aaron Newton February 26th, 2009 @ 05:41 PM

    @SixtyMonkey - the only problem with something like that that I can see is that your class has a dependency on MooTools and MooTools more. In my mind, such functionality should be stand-alone so that it can load the library as well...

  • Daniel Steigerwald

    Daniel Steigerwald February 26th, 2009 @ 05:55 PM

    Yes JanK. Using proper events would be better. But please, somebody has to fix them to be removable by its listener to prevent repeated firing if somebody needs it. I suggested fix here: http://mootools.lighthouseapp.co...

  • Chris the Developer

    Chris the Developer February 27th, 2009 @ 06:43 AM

    @anutron: Fair comments, but currently the Assets Class lives in more and more is never loaded without core, so this would still occupy the same spot. As it is, the Assets class is just that; a class. That functionality wouldn't exist before core was loaded, so one must assume that this new class would never be used to load core.

    In that case, the only things that need to be dropped is dependency on more, and I can't see where the proposed architecture is dependent on more - if you wouldn't mind showing me, I would greatly appreciate it.

  • Chris the Developer

    Chris the Developer February 27th, 2009 @ 06:46 AM

    @anutron: Perhaps it would be useful if I showed you my test case;

    {{{ <!DOCTYPE html>

    var loader = new Loader({
        'scripts': ['load.mootools.more.js', 'load.mootools.extensions.js', 'load.mootools.hyperion.js', 'load.mootools.datefield.js'],
        'styles': ['load.testing.css', 'load.testing2.css', 'load.testing3.css', 'load.testing4.css'],
        'images': ['load.queued.png', 'load.register.png', 'load.renew.png', 'load.special.png'],
        'onProgress': function(a,b,c,d,e) {
            console.log('progress',a,b,c,d,e);
        },
        'onComplete': function(a,b,c,d) {
            console.log('complete',a,b,c,d);
        }
    });
    <\/code><\/pre>
    
    

    }); }}}

  • Chris the Developer

    Chris the Developer February 27th, 2009 @ 06:46 AM

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Loader</title>
    </head>
    <body>
    <script type="text/javascript" src="mootools.core.js"></script>
    <script type="text/javascript" src="mootools.loader.js"></script>
    <script type="text/javascript">
    window.addEvent('domready', function() {
    	var loader = new Loader({
    		'scripts': ['load.mootools.more.js', 'load.mootools.extensions.js', 'load.mootools.hyperion.js', 'load.mootools.datefield.js'],
    		'styles': ['load.testing.css', 'load.testing2.css', 'load.testing3.css', 'load.testing4.css'],
    		'images': ['load.queued.png', 'load.register.png', 'load.renew.png', 'load.special.png'],
    		'onProgress': function(a,b,c,d,e) {
    			console.log('progress',a,b,c,d,e);
    		},
    		'onComplete': function(a,b,c,d) {
    			console.log('complete',a,b,c,d);
    		}
    	});
    });
    </script>
    </body>
    </html>
    
  • Aaron Newton

    Aaron Newton February 27th, 2009 @ 06:47 AM

    What I mean is SixtyMonkey is that if I were to build a loader for numerous assets I would use it to load up my application (like Gmail's loading screen). I would write it in vanilla javascript so it would work without any other dependencies. This would allow me to have the loader load first, then load all the dependencies. This is outside the scope of the Assets methods (they aren't classes) which are really just convenience methods for injecting items into the head and pre-loading images.

  • Chris the Developer

    Chris the Developer February 27th, 2009 @ 07:29 AM

    Ok, I understand that. :)

    Wouldn't creating a unified API for this, mean rewriting a lot of pre-existing code? Is the plan to redo the Asset class in this way, or is it just an ideal? This is all very interesting :D

  • fakedarren

    fakedarren February 8th, 2010 @ 05:44 PM

    • State changed from “new” to “open”
    • Assigned user changed from “Aaron Newton” to “Jan Kassens”

    Opened and assigned to OP :D

  • fakedarren

    fakedarren February 13th, 2010 @ 11:30 AM

    To reduce number of open (and technically duplicate) tickets

    #16 #52 #126 #310 #493

    All relate to Asset events. So I will mark them all as duplicates, and this will remain open.

  • Jan Kassens

    Jan Kassens June 9th, 2010 @ 11:18 AM

    • Assigned user cleared.
  • Christoph Pojer

    Christoph Pojer June 9th, 2010 @ 01:58 PM

    • Assigned user set to “Aaron Newton”
  • Christoph Pojer

    Christoph Pojer September 3rd, 2010 @ 01:18 PM

    • State changed from “open” to “duplicate”
    • Milestone order changed from “0” to “0”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Referenced by

Pages