今日摘要
lodash api
- times: 执行多次函数
_.times(10, function(){ person.age = _.random(40); });
more
// 生成字符数组 _.times(3, String); // [“0”, “1”, “2”]
mobx api
- autorun
var person = mobx.observable({
firstName: 'Matt',
lastName : 'Ruby',
age : 34,
fullName: function(){
return this.firstName + ' ' + this.lastName;
}
});
mobx.autorun(function(){
console.log(person.firstName + ' ' + person.age);
})
person.firstName = 'Mike'