• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Yui3在美团 2
 

Yui3在美团 2

on

  • 1,534 views

 

Statistics

Views

Total Views
1,534
Views on SlideShare
1,436
Embed Views
98

Actions

Likes
4
Downloads
18
Comments
0

3 Embeds 98

http://www.haogongju.net 59
http://www.cnblogs.com 37
http://blog.573114.com 2

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

    Yui3在美团 2 Yui3在美团 2 Presentation Transcript

    • YUI3 2011-7-30
    • • / spring http://shangchun.net springuper@gmail.com• 2010 12•
    • • YUI3 YUI3• Combo Loading
    • •••
    • YUI2 YUI3YUI3 YUI
    • Chaining SelectorAOP YUI3 Loader OOP
    • var Y = YUI();YUI.add(‘test’, function(Y) { Y.use(‘test’, function(Y) { Y.sayHello = function() { Y.sayHello(); // alert alert(‘Hello, world!’); }); }; YUI().use(function(Y) {}); Y.sayHello(); // error });
    • addYUI.prototype.add = function(name, fn, details) { // register on the global object YUI YUI.Env.mods[name] = { name: name, fn: fn, details: details || {} }; return this;};YUI.add = YUI.prototype.add;
    • useYUI.prototype.use = function() { var Y = this, r = [], args = Array.prototype.slice.call(arguments, 0), callback = args[args.length - 1], process = function(names) { ... }; args.pop(); process(args); // calculate sorted full module list r Y._attach(r); // add the apis to Y callback(Y); return this;};
    • Module vs <script>••••
    • YUI3 Drag & Drop AnimationComponent IO Cookie JSON ...Component Widget BaseFramework Attribute Plugin DOM Node Core Event OOP Seed YUI
    • •• Combo• Loading•
    • mis crm finance stat... www ecom...
    • ••••
    • javascript mis-deal mis-order Site App finance-pay stat-compete ... Site Core mis-base www-base ... mt-base w-base w-table Core w-autocomplete ...Base & Frame YUI3
    • mis-order mis-misc ...www-base mis-base w-base w-autocomplete ... mt-base vendor yui node event io ...
    • mt.js [mt-base] w-base.js [w-base] core w-tab.js [w-tab] w-date.js [w-date] ... www in the near future base.js [mis-base] deal.js [mis-deal]static mis js order.js [mis-order] misc.js [mis-misc] finance js pay.js [finance-pay] vendor js jquery.min.js zeroClipboard.js ... ...
    • var M = window.M || {};M._YUI = YUI;M.add = function() { M._YUI.add.apply(M._YUI, arguments); return this;};M.use = function() { var instance = M._YUI(YUI_META); instance.use.apply(instance, arguments); return this;};
    • // static/mis/js/deal.js(function() {M.add(‘mis-deal’, function(Y) { var $MIS = Y.mt.mis, isIE = Y.UA.ie ... // shortcut var CONST = ‘const value‘ ... // const Y.namespace(‘mt.mis.Deal’); Y.mt.mis.Deal = { editInfo:function(param) { ... } };}, ‘1.0.0’, { requires:M.Groups[‘mis’][‘modules’][‘deal’].requires });})();
    • // helper/FileHelper.phpprivate static $groups = array( ‘core’ => array(...), ‘www’ => array(...), ‘mis’ => array( ‘mis-deal’ => array( ‘path’ => ‘mis/js/deal.js’, ‘requires’ => array(‘mis-base’, ‘w-tab’), ), ), ...);
    • Combo Minify (BSD, http://code.google.com/p/minify/)// debugFirePHP// bad request header, CDN caches 400$min_serveOptions[‘badRequestHeader’] = ‘HTTP/1.0 404 Not Found’;// stop minifiers$min_serveOptions[‘minifiers’] [‘application/x-javascript’] = null;$min_serveOptions[‘minifiers’] [‘text/css’] = null;
    • Loader// php frame$loader = new YUILoader( PHP Loader FileHelper::YUI3_VERSION, FilerHelper::getMTModules());// template$loader->misInit(‘mis-deal’, “ Y.mt.mis.Deal.editInfo(‘. $status. ’, ‘ . $modReason. ’);“);
    • http://c.meituan.net/f=static/mis/js/base.v1692bda7.js,static/core/w-core.vea9d9098.js,static/core/w-base.v24ec835d.js,static/vendor/js/data-pinyin.vc77e80e1.js,static/core/w-autocomplete.vd0296db5.js,static/core/w-table.vcb4c553c.js,static/core/w-date.vc94a7365.js,static/core/w-validate.va0f58428.js v + md5
    • •• YUI3 - below the surface Luke Smith• YUI2 YUI3•
    • • MacBook Pro• 27” IPS• ENJOY
    • Thanks Q &A