bindy / bindy.github.com Goto Github PK
View Code? Open in Web Editor NEWabout my blog
about my blog
1.为对象设置Observer,遍历对象中的key属性,使用 Object.defineProperty函数 分别属性设置 getter 和 setter方法,从而可以对每个属性进行监听并执行回调函数
2.使用一个Dep对象来存储 Watcher,进行收集和通知
3.用户订阅需要的属性,初始化 watcher
4.在进行相关属性修改的时候,会触发订阅,Dep对象开始通知并收集要观察的对象,进行数据更新以及执行业务逻辑,并更新当前的观察者的值
//数组去重
util.unique = function(arr) {
//声明空数组ret,空对象o
var ret = []
var o = {}
//将数组对象执行forEach方法,得到去重后的对象o , 巧妙 XD
forEach(arr, function(item) {
o[item] = 1
})
//对象以键值数组化
if (Object.keys) {
ret = Object.keys(o)
}
else {
for (var p in o) {
if (o.hasOwnProperty(p)) {
ret.push(p)
}
}
}
//返回数组
return ret
}
1.什么是模块化
2.如何实现模块化
3.ES6的模块化
1.promise原理
2.css style与canvas轮播的对比
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.