Enviar pesquisa
Carregar
KISSY Mechanism
•
10 gostaram
•
1,232 visualizações
L
lifesinger
Seguir
KISSY 类库构想与实践
Leia menos
Leia mais
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 50
Baixar agora
Baixar para ler offline
Recomendados
Intro-to-SeaJS
Intro-to-SeaJS
lifesinger
Style基础优化之独角兽篇
Style基础优化之独角兽篇
fangdeng
Dive into kissy
Dive into kissy
jay li
Node分享 展烨
Node分享 展烨
tb-vertical-guide
Kissy design
Kissy design
yiming he
kissy 1.5 progress
kissy 1.5 progress
yiming he
SASS入門實作
SASS入門實作
Kingsley Zheng
Kissy简介
Kissy简介
jay li
Recomendados
Intro-to-SeaJS
Intro-to-SeaJS
lifesinger
Style基础优化之独角兽篇
Style基础优化之独角兽篇
fangdeng
Dive into kissy
Dive into kissy
jay li
Node分享 展烨
Node分享 展烨
tb-vertical-guide
Kissy design
Kissy design
yiming he
kissy 1.5 progress
kissy 1.5 progress
yiming he
SASS入門實作
SASS入門實作
Kingsley Zheng
Kissy简介
Kissy简介
jay li
使用kslite支持第三方内容开发
使用kslite支持第三方内容开发
leneli
超。光速 網站最佳化實戰 -twMVC#8
超。光速 網站最佳化實戰 -twMVC#8
twMVC
使用Bigpipe提升浏览速度
使用Bigpipe提升浏览速度
kumawu
Asp.net on windows azure cloud service (updated)
Asp.net on windows azure cloud service (updated)
Jeff Chu
Gulp.js 自動化前端任務流程
Gulp.js 自動化前端任務流程
洧杰 廖
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
部落格行銷
部落格行銷
jehuen
编辑器设计Kissy editor
编辑器设计Kissy editor
taobao.com
Koubei banquet 34
Koubei banquet 34
Koubei UED
浅析浏览器解析和渲染
浅析浏览器解析和渲染
Ailsa126
Web App 调试基础 (1)
Web App 调试基础 (1)
Xiaoping Feng
Node.js 入門 - 前端工程開發實務訓練
Node.js 入門 - 前端工程開發實務訓練
Joseph Chiang
Style基础优化之独角兽篇
Style基础优化之独角兽篇
fangdeng
支付宝CSS构架
支付宝CSS构架
Sofish Lin
Alice库构建
Alice库构建
Sofish Lin
Ch04 會話管理
Ch04 會話管理
Justin Lin
编辑器设计U editor
编辑器设计U editor
taobao.com
第三方内容开发最佳实践
第三方内容开发最佳实践
taobao.com
Yui rocks
Yui rocks
Adam Lu
Dialysis dose prescription (the basics) dr ujjawal
Dialysis dose prescription (the basics) dr ujjawal
Ujjawal Roy
Erlang游戏开发
Erlang游戏开发
litaocheng
Erlang开发及应用
Erlang开发及应用
litaocheng
Mais conteúdo relacionado
Mais procurados
使用kslite支持第三方内容开发
使用kslite支持第三方内容开发
leneli
超。光速 網站最佳化實戰 -twMVC#8
超。光速 網站最佳化實戰 -twMVC#8
twMVC
使用Bigpipe提升浏览速度
使用Bigpipe提升浏览速度
kumawu
Asp.net on windows azure cloud service (updated)
Asp.net on windows azure cloud service (updated)
Jeff Chu
Gulp.js 自動化前端任務流程
Gulp.js 自動化前端任務流程
洧杰 廖
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
部落格行銷
部落格行銷
jehuen
编辑器设计Kissy editor
编辑器设计Kissy editor
taobao.com
Koubei banquet 34
Koubei banquet 34
Koubei UED
浅析浏览器解析和渲染
浅析浏览器解析和渲染
Ailsa126
Web App 调试基础 (1)
Web App 调试基础 (1)
Xiaoping Feng
Node.js 入門 - 前端工程開發實務訓練
Node.js 入門 - 前端工程開發實務訓練
Joseph Chiang
Style基础优化之独角兽篇
Style基础优化之独角兽篇
fangdeng
支付宝CSS构架
支付宝CSS构架
Sofish Lin
Alice库构建
Alice库构建
Sofish Lin
Ch04 會話管理
Ch04 會話管理
Justin Lin
编辑器设计U editor
编辑器设计U editor
taobao.com
第三方内容开发最佳实践
第三方内容开发最佳实践
taobao.com
Yui rocks
Yui rocks
Adam Lu
Mais procurados
(19)
使用kslite支持第三方内容开发
使用kslite支持第三方内容开发
超。光速 網站最佳化實戰 -twMVC#8
超。光速 網站最佳化實戰 -twMVC#8
使用Bigpipe提升浏览速度
使用Bigpipe提升浏览速度
Asp.net on windows azure cloud service (updated)
Asp.net on windows azure cloud service (updated)
Gulp.js 自動化前端任務流程
Gulp.js 自動化前端任務流程
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
部落格行銷
部落格行銷
编辑器设计Kissy editor
编辑器设计Kissy editor
Koubei banquet 34
Koubei banquet 34
浅析浏览器解析和渲染
浅析浏览器解析和渲染
Web App 调试基础 (1)
Web App 调试基础 (1)
Node.js 入門 - 前端工程開發實務訓練
Node.js 入門 - 前端工程開發實務訓練
Style基础优化之独角兽篇
Style基础优化之独角兽篇
支付宝CSS构架
支付宝CSS构架
Alice库构建
Alice库构建
Ch04 會話管理
Ch04 會話管理
编辑器设计U editor
编辑器设计U editor
第三方内容开发最佳实践
第三方内容开发最佳实践
Yui rocks
Yui rocks
Destaque
Dialysis dose prescription (the basics) dr ujjawal
Dialysis dose prescription (the basics) dr ujjawal
Ujjawal Roy
Erlang游戏开发
Erlang游戏开发
litaocheng
Erlang开发及应用
Erlang开发及应用
litaocheng
Couchdb Beijing Openparty
Couchdb Beijing Openparty
litaocheng
Memcached 剖析
Memcached 剖析
litaocheng
Physiological function of pd
Physiological function of pd
Ahmed Salah
Basement Membrane Abnormalities
Basement Membrane Abnormalities
edwinchowyw
Erlang Practice
Erlang Practice
litaocheng
Jose Maria Morales - Spain - Tuesday 29 - HLA for Renal Allocation
Jose Maria Morales - Spain - Tuesday 29 - HLA for Renal Allocation
incucai_isodp
Heparin and dialysis – hhd and pd
Heparin and dialysis – hhd and pd
socialkidney
Hemodialysis basics
Hemodialysis basics
أحمد عبد الوهاب الجندي
Diabetes insipidus
Diabetes insipidus
bmartin53
Diabetes Insipidus
Diabetes Insipidus
PeninsulaEndocrine
Approach to a child with hematuria
Approach to a child with hematuria
Sunil Agrawal
KIDNEY TRANSPLANTATION SEMINAR PRESENTATION
KIDNEY TRANSPLANTATION SEMINAR PRESENTATION
fareedresidency
Kidney transplantation
Kidney transplantation
Jijo G John
Destaque
(16)
Dialysis dose prescription (the basics) dr ujjawal
Dialysis dose prescription (the basics) dr ujjawal
Erlang游戏开发
Erlang游戏开发
Erlang开发及应用
Erlang开发及应用
Couchdb Beijing Openparty
Couchdb Beijing Openparty
Memcached 剖析
Memcached 剖析
Physiological function of pd
Physiological function of pd
Basement Membrane Abnormalities
Basement Membrane Abnormalities
Erlang Practice
Erlang Practice
Jose Maria Morales - Spain - Tuesday 29 - HLA for Renal Allocation
Jose Maria Morales - Spain - Tuesday 29 - HLA for Renal Allocation
Heparin and dialysis – hhd and pd
Heparin and dialysis – hhd and pd
Hemodialysis basics
Hemodialysis basics
Diabetes insipidus
Diabetes insipidus
Diabetes Insipidus
Diabetes Insipidus
Approach to a child with hematuria
Approach to a child with hematuria
KIDNEY TRANSPLANTATION SEMINAR PRESENTATION
KIDNEY TRANSPLANTATION SEMINAR PRESENTATION
Kidney transplantation
Kidney transplantation
Semelhante a KISSY Mechanism
KISSY for starter
KISSY for starter
yiming he
.NET Conf Taiwan 2022 - Tauri -前端人員也能打造小巧快速的 Windows 應用程式
.NET Conf Taiwan 2022 - Tauri -前端人員也能打造小巧快速的 Windows 應用程式
升煌 黃
kissy@2013
kissy@2013
yiming he
Web development with zend framework
Web development with zend framework
thinkinlamp
Node js实践
Node js实践
myzykj
Kissy模块化实践
Kissy模块化实践
yiming he
Simple kissy1.3
Simple kissy1.3
yiming he
合久必分,分久必合
合久必分,分久必合
Qiangning Hong
Node.js在淘宝的应用实践
Node.js在淘宝的应用实践
taobao.com
D2_node在淘宝的应用实践_pdf版
D2_node在淘宝的应用实践_pdf版
Jackson Tian
Berserk js
Berserk js
taobao.com
编辑器设计2
编辑器设计2
yiming he
DEV305 - ASP.NET 5 開發攻略
DEV305 - ASP.NET 5 開發攻略
Will Huang
课题二:Node.js那些事儿
课题二:Node.js那些事儿
Liu Allen
Artifacts management with CI and CD
Artifacts management with CI and CD
Chen-Tien Tsai
Mvc
Mvc
tbmallf2e
Php study.20130110
Php study.20130110
bngoogle
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
Wen-Tien Chang
KISSY Editor Design 2
KISSY Editor Design 2
yiming he
Template mb-kao
Template mb-kao
xwcoder
Semelhante a KISSY Mechanism
(20)
KISSY for starter
KISSY for starter
.NET Conf Taiwan 2022 - Tauri -前端人員也能打造小巧快速的 Windows 應用程式
.NET Conf Taiwan 2022 - Tauri -前端人員也能打造小巧快速的 Windows 應用程式
kissy@2013
kissy@2013
Web development with zend framework
Web development with zend framework
Node js实践
Node js实践
Kissy模块化实践
Kissy模块化实践
Simple kissy1.3
Simple kissy1.3
合久必分,分久必合
合久必分,分久必合
Node.js在淘宝的应用实践
Node.js在淘宝的应用实践
D2_node在淘宝的应用实践_pdf版
D2_node在淘宝的应用实践_pdf版
Berserk js
Berserk js
编辑器设计2
编辑器设计2
DEV305 - ASP.NET 5 開發攻略
DEV305 - ASP.NET 5 開發攻略
课题二:Node.js那些事儿
课题二:Node.js那些事儿
Artifacts management with CI and CD
Artifacts management with CI and CD
Mvc
Mvc
Php study.20130110
Php study.20130110
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
KISSY Editor Design 2
KISSY Editor Design 2
Template mb-kao
Template mb-kao
Mais de lifesinger
SeaJS 那些事儿
SeaJS 那些事儿
lifesinger
SeaJS - 前端模块化开发探索与网站性能优化实践
SeaJS - 前端模块化开发探索与网站性能优化实践
lifesinger
开放式类库的构建
开放式类库的构建
lifesinger
让开发也懂前端
让开发也懂前端
lifesinger
SeaJS - 跨环境模块化开发实践
SeaJS - 跨环境模块化开发实践
lifesinger
Progressive Enhancement
Progressive Enhancement
lifesinger
The Beauty Of Refactoring
The Beauty Of Refactoring
lifesinger
Closure Compiler vs YUICompressor
Closure Compiler vs YUICompressor
lifesinger
Mais de lifesinger
(8)
SeaJS 那些事儿
SeaJS 那些事儿
SeaJS - 前端模块化开发探索与网站性能优化实践
SeaJS - 前端模块化开发探索与网站性能优化实践
开放式类库的构建
开放式类库的构建
让开发也懂前端
让开发也懂前端
SeaJS - 跨环境模块化开发实践
SeaJS - 跨环境模块化开发实践
Progressive Enhancement
Progressive Enhancement
The Beauty Of Refactoring
The Beauty Of Refactoring
Closure Compiler vs YUICompressor
Closure Compiler vs YUICompressor
KISSY Mechanism
1.
面向未来的前端类库开发 — KISSY
类库构想与实践 王保平(玉伯)@ 淘宝 2010/12/18
2.
Topics •
KISSY 类库介绍 • 种子 seed • 种子的长大 core • 基亍 mixin 的 UI 组件构建 • 展望
3.
不重复造“相同的”轮子
4.
KISSY on Github
5.
小巧灵活,简洁实用 使用起来让人感觉愉悦
6.
• switchable
• calendar components • overlay •… • dom • event core • ajax • ... • kernel seed • web • loader
7.
种子 seed
8.
web apps
components core {dom/event/anim/ajax/…} web.js loader kernel seed {kissy.js, lang.js}
9.
kissy.js (function(host, S) {
var meta = { mix: function }, seed = (host && host[S]) || {}; host[S] = meta.mix(seed,meta,false); })(this, „KISSY‟);
10.
• 原子(meta):
var meta = { mix: fn } • 宿主(host): (function(host, S) { })(this, „KISSY‟); • 种子(seed): seed = (host && host[S]) || {}; meta.mix(seed, meta, false);
11.
• 种子具有 mix()
和 host 两方面特性。 • 一个系统诞生自一个种子,host 是种子的 培育土壤,种子通过不断 mix() 而成长, 可生长成任意复杂的系统。 • 传入的种子可以是已存在的复杂系统。
12.
用 jQuery 做种子 <script
src=“jquery.js”></script> <script> window[„KISSY‟] = jQuery; </script> <script src=“kissy.js”></script> <script> KISSY(„<p>Hello world!</p>‟) .appendTo(document.body); </script>
13.
种子的长大 <script src=“labjs.js”></script> <script>
KISSY.mix(KISSY, $LAB); </script> <script> KISSY.script(„a.js‟).wait() .script(„b.js‟); </script>
14.
基亍 seed, 构建基础类库的方式 ①
seed + mix(开源类库) ② seed + mix(自主研发) ③ seed + mix(开源类库 + 自主研发)
15.
• KISSY 选择第三种方式 •
mix 的开源类库有:sizzle, json2 • seed 和其他功能自主研发
16.
17.
kernel 的特性 • host
无关,可运行在任意宿主环境中 例子一:在 BESENShell 中运行 例子二:在 Photoshop CS5 中运行 好处一:在服务器端运行 好处二:可装载到任意闭包,沙箱隔离 • 与 ES5 兼容 面向未来,春暖花开
18.
与浏览器相关的方法
web.js loader kernel {kissy.js, lang.js} 模块注册/加载/调用
19.
20.
loader • 内置模块,无需 add,
直接 use • 支持静态和劢态两种方式 KISSY.add(„modName‟, { fullpath: „path/to/mod.js‟, requires: [„core‟] }); KISSY.use(„modName,calendar‟, callback);
21.
用 S.app 构建应用 KISSY.app(„D2‟); D2.add(„克军‟,
{ fullpath: „中国/北京/豆瓣‟ }); D2.use(„克军‟, function() { … }); D2.namespace(„China‟);
22.
前端页面构建
Module Module Module Module Module PageLogic Apps KISSY
23.
小结 •
系统诞生亍种子 • 种子通过 mix 长大 • KISSY 选择 seed + mix(开源 + 自主研发) • seed 里包含 kernel + web.js + loader • kernel 与 host 无关 • 构建应用的方式:S.app • kissy seed 是一个独立的迷你类库
24.
种子的长大 core
25.
26.
模块化、颗粒化 • 模块是 kissy
里文件级 的代码组织方式 • 一个模块可以由多个 子模块组成
27.
API 的 20/80
原则 • 实现常用的 20% 功能 • 满足用户 80% 的需求 • 例子一:selector 默认只支持 #id tag.class • 例子二:dom 中无 range 相关方法
28.
core 层的实现方式
29.
attr 的演化(1) DOM.getAttribute =
function(el, name) { } DOM.setAttribute = function(el, name, value) { }
30.
attr 的演化(2) DOM.attr =
function(el, name, value) { if(value === undefined) { return getAttribute(el, name); } setAttribute(el, name, value); }
31.
attr 的演化(3) DOM.META.getAttribute =
fn DOM.META.setAttribute = fn DOM.attr = publish(„Attribute‟);
32.
attr 的演化(4) DOM.META =
{ getAttribute: fn, setAttribute: fn, getStyle: fn, setStyle: fn, … }; S.publish(DOM.META).to(DOM, config);
33.
attr 的演化(5) S.publish(DOM.META).to(DOM, cfg); S.publish(Event.META).to(Event,
cfg); S.publish([DOM, Event]).to(Node, cfg); S.Node(„<p>‟) .attr(„data‟, „Hedger is an JS ninja!‟);
34.
实现方式小结 • 一处只干一件事 • 用
META 层封装原子方法 • 用 publish 机制变换为 public api • 注1:目前尚未完成重构。 • 注2:要特别感谢 QWrap 团队的分享,publish 构想借 鉴了 QWrap 的 retouch 思路。 • 注3:做好后,会尝试将 META 层独立开源出来,使得能 像 sizzle 一样,可复用到其他类库,可自由替换。
35.
基亍 Base 的组件开发
36.
Base 示例
37.
小结 • 代码组织方式:模块化 、颗粒化 •
代码实现方式:META 层 + publish 变换 • 组件基础构建:Base
38.
基于 mixin 的
UI 组件构建
39.
40.
41.
基亍约定的 UIBase Extension •
constructor / destructor • UI 的三个阶段:renderUI / bindUI / syncUI • uiSetAttribute function Position() {} Position.ATTRS = { x:{}, y:{}, xy:{} } Position.prototype = { __renderUI: fn, __bindUI: fn, __syncUI: fn, _uiSetX: fn, __destructor: fn }
42.
模拟 C++ 的多继承
43.
基亍 mixin 的多继承小结 •
世界很复杂,完美的类抽象很难 • 适度继承 + 选择性 mix • 约定优亍配置 • 好处:可复用性高,整体维护方便 • 不足:成员冲突,门槛稍高
44.
展望
45.
Roadmap
社区化、子品牌 常用组件 基础核心
46.
47.
48.
期待这里出现你的名字
49.
It’s NOT the
destination, but just where we BEGIN!
50.
Any Questions? kissy: http://kissyteam.github.com/ twitter:
@lifesinger blog: http://lifesinger.org/ gtalk: lifesinger@gmail.com
Baixar agora