• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
The Once And Future Script Loader (v3)
 

The Once And Future Script Loader (v3)

on

  • 3,246 views

 

Statistics

Views

Total Views
3,246
Views on SlideShare
3,112
Embed Views
134

Actions

Likes
2
Downloads
26
Comments
0

9 Embeds 134

http://speakerrate.com 51
http://lanyrd.com 47
http://presentworth.blogspot.com 16
http://us-w1.rockmelt.com 8
http://paper.li 6
http://user03.in-set.com 3
http://tweetedtimes.com 1
http://www.linkedin.com 1
https://crowdflower.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    The Once And Future Script Loader (v3) The Once And Future Script Loader (v3) Presentation Transcript

    • The Once and Future Script Loader Kyle Simpson @getify http://getify.me
    • <script>
    • Why not just combine all your files?• different pages, different scripts• cacheability• parallel loading• on-demand/lazy-loading
    • concat vs. parallel? BOTH
    • document.write()
    • document.write() Must Die!
    • Performance
    • IE7-, FF3-, Opera
    • IE8, FF3.5/3.6, Chr 14-
    • IE9+, FF4+Script Loaders
    • comparing DOM-ready times across loading techniques
    • <script> tags also suck because... • browser-specific scripts • conditional loading/URLs • event handling
    • WTF Loaderdocument.write("<script src=...></sc"+"ript>");
    • Surely we can do better!?
    • XHR?
    • Making progress... but not there yet
    • Whats hard about script loading?
    • A general script loader should...• load any script, at any time, fromanywhere... except document.write()• have performance at or better than<script> in modern browsers• equivalent behavior in all browsers
    • A general script loader should also...• avoid: hacks, UA sniffing• feature-detect• have as few exception-cases as possible
    • General script loader feature creep...• trying to handle document.write()• loading CSS• dependency management• delaying DOM-ready
    • Script loading requires...• loading many scripts in parallel(race to finish loading ASAP)• ensuring execution order (not ASAP)
    • LABjs
    • LABjs: performance script loader
    • LABjs: performance script loader
    • What was wrong with LABjs?• ugly source code• lots of hacks• exception cases• brittle (not future proof)
    • LABjs 2.0• readable source code• "future proof " feature detects• fewer exception cases• better performance http://labjs.com
    • Anyone can write a loader! (and many devs have)
    • https://spreadsheets0.google.com/spreadsheet/ccc?key=tDdcrv9wNQRCNCRCflWxhYQ
    • Loaders are competing more on APIs than onfeatures or performance
    • Theyre also copyingeach other (good and bad)
    • But, can theirfunctionality be trusted?
    • Testing is much harder than most realize
    • What should a loader do?
    • Real Preloadinghttp://wiki.whatwg.org/wiki/Script_Execution_Control
    • IE4+ ftw?
    • Ordered Async async=falseFF4+, Chr 12+, IE10p2+, Webkit/Safari, Opera (soon!) http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
    • How?1. try real preloading2. try ordered async3. try same-domain XHR4. fall back on "cache preloading"
    • Competition is good, only if community is educated
    • Browsers do not yet give us what we really need
    • Co-opetition is much healthier for the community
    • W3C, WHATWGhttp://wiki.whatwg.org/wiki/Category:Proposals
    • W3C, WHATWGhttp://ygp.go.ly/script-preloadinghttp://odq.go.ly/load-error-events
    • Well accomplish more if we work together
    • Future, The Script Loader
    • Preloading(deferred execution)
    • Modules(CommonJS, AMD, etc)
    • Native Modules(ES-Harmony?)
    • "Script Loader of my dreams"
    • What else?• timeouts• load abort• error handling• load priority
    • And now for somethingcompletely different... Questions?
    • Kyle Simpson @getify http://getify.mehttp://wiki.whatwg.org/wiki/Category:Proposals http://labjs.com