Coder Social home page Coder Social logo

bindy.github.com's People

Contributors

bindy avatar

Watchers

 avatar

bindy.github.com's Issues

Js模块化

1.什么是模块化
2.如何实现模块化
3.ES6的模块化

Vue.js 中的订阅-观察者模式

1.为对象设置Observer,遍历对象中的key属性,使用 Object.defineProperty函数 分别属性设置 getter 和 setter方法,从而可以对每个属性进行监听并执行回调函数
2.使用一个Dep对象来存储 Watcher,进行收集和通知
3.用户订阅需要的属性,初始化 watcher
4.在进行相关属性修改的时候,会触发订阅,Dep对象开始通知并收集要观察的对象,进行数据更新以及执行业务逻辑,并更新当前的观察者的值

js 奇淫技巧

//数组去重

  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
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.