Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Upgrade Your YUI3

ningzbruc
January 24, 2013

Upgrade Your YUI3

Upgrade your yui3 from 3.3.0 to the latest version, there's a very useful property of yui config which is 'async' to make your js files load more faster!

ningzbruc

January 24, 2013

Transcript

19 slides
  1. async: true YUI.GlobalConfig = { base: 'http://a.tbcdn.cn/s/yui/' + YUI.version +

    '/build/', comboBase: 'http://a.tbcdn.cn/s/yui/' + YUI.version + '/build/??', root: '', charset: 'gbk', comboSep: ',', maxURLLength: 2048, combine: true, async: true, // default true groups: { } }; since 3.5.0...
  2. Module States - 2 YUI.add('module-a', function(Y) { // will be

    attached to Y after used Y.ModuleA = {}; }); YUI().use('module-a', function(Y) { // Y.ModuleA is available }); YUI().use('node', function(Y) { // another YUI instance // module-a is not attached to Y }); 1 0
  3. Module States -3 YUI().use('a', 'b', 'c', function(Y) { // 1.

    loading modules a, b, c in parallel // 2. all modules are loaded // 3. attached a, b, c to Y in order // 4. all modules are available now in this callback });
  4. Custom Unwrapped Module YUI({ modules: { a: { // 8s

    fullpath: 'http://a.tbcdn.cn/app/dp/insure/autoins/js/a.php' }, b: { // 2s fullpath: 'http://a.tbcdn.cn/app/dp/insure/autoins/js/b.php', requires: ['a'] } } }).use('b');
  5. Custom Unwrapped Module - 2 YUI({ modules: { a: {

    // 8s fullpath: 'http://a.tbcdn.cn/app/dp/insure/autoins/js/a.php', async: false }, b: { // 2s fullpath: 'http://a.tbcdn.cn/app/dp/insure/autoins/js/b.php', async: false, requires: ['a'] } } }).use('b');
  6. • IE 2048 • Apache 8192 • 3.3.0 2048 ||

    8192 • 3.5.1 1024 || 2048 maxURLLength
  7. 3.3.0 3.5.1 http://a.tbcdn.cn/??s/yui/3.5.1/build/oop/oop-min.js,s/yui/3.5.1/ build/event-custom-base/event-custom-base-min.js,s/yui/3.5.1/build/ dom-core/dom-core-min.js,s/yui/3.5.1/build/dom-base/dom-base- min.js,s/yui/3.5.1/build/selector-native/selector-native-min.js,s/ yui/3.5.1/build/selector/selector-min.js,s/yui/3.5.1/build/node-core/ node-core-min.js,s/yui/3.5.1/build/node-base/node-base-min.js,s/yui/ 3.5.1/build/event-base/event-base-min.js,s/yui/3.5.1/build/event- delegate/event-delegate-min.js,s/yui/3.5.1/build/node-event-delegate/

    node-event-delegate-min.js,s/yui/3.5.1/build/pluginhost-base/ pluginhost-base-min.js,s/yui/3.5.1/build/pluginhost-config/ pluginhost-config-min.js,s/yui/3.5.1/build/node-pluginhost/node- pluginhost-min.js,s/yui/3.5.1/build/dom-style/dom-style-min.js,s/yui/ 3.5.1/build/dom-screen/dom-screen-min.js,s/yui/3.5.1/build/node- screen/node-screen-min.js,s/yui/3.5.1/build/node-style/node-style- min.js http://a.tbcdn.cn/??s/yui/3.3.0/build/oop/oop-min.js,s/yui/3.3.0/ build/event-custom/event-custom-base-min.js,s/yui/3.3.0/build/event/ event-base-min.js,s/yui/3.3.0/build/pluginhost/pluginhost-min.js,s/ yui/3.3.0/build/dom/dom-min.js,s/yui/3.3.0/build/node/node-min.js,s/ yui/3.3.0/build/event/event-delegate-min.js 311 919 comboLength

More Decks by ningzbruc

Other Decks in Technology