{"action":"opened","issue":{"url":"https://api.github.com/repos/LSYY888/ruby.github.io/issues/6","repository_url":"https://api.github.com/repos/LSYY888/ruby.github.io","labels_url":"https://api.github.com/repos/LSYY888/ruby.github.io/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/LSYY888/ruby.github.io/issues/6/comments","events_url":"https://api.github.com/repos/LSYY888/ruby.github.io/issues/6/events","html_url":"https://github.com/LSYY888/ruby.github.io/issues/6","id":191485879,"number":6,"title":"bind(this)","user":{"login":"LSYY888","id":20336233,"avatar_url":"https://avatars.githubusercontent.com/u/20336233?v=3","gravatar_id":"","url":"https://api.github.com/users/LSYY888","html_url":"https://github.com/LSYY888","followers_url":"https://api.github.com/users/LSYY888/followers","following_url":"https://api.github.com/users/LSYY888/following{/other_user}","gists_url":"https://api.github.com/users/LSYY888/gists{/gist_id}","starred_url":"https://api.github.com/users/LSYY888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LSYY888/subscriptions","organizations_url":"https://api.github.com/users/LSYY888/orgs","repos_url":"https://api.github.com/users/LSYY888/repos","events_url":"https://api.github.com/users/LSYY888/events{/privacy}","received_events_url":"https://api.github.com/users/LSYY888/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-24T10:37:02Z","updated_at":"2016-11-24T10:37:02Z","closed_at":null,"body":"![bind](https://cloud.githubusercontent.com/assets/20336233/20595440/d8e11274-b274-11e6-82cd-b16ae042d182.png)\r\nthis的作用域问题。个人有个小技巧是\r\n1.判断离最近的父function，这里且叫fatherFunc\r\n2.fatherFunc是构造函数或prototype函数，或者bind了对象，则this指向对象；否则this指向fatherFunc的调用环境:\r\n\r\n父函数正常调用fatherFunc()时，this指向window或global;\r\n指定执行环境时fatherFunc.apply(obj,args) 或fatherFunc.call(obj,args)，this指向对象obj；\r\n作为DOM事件处理函数:element.addEventListener(eventType,fatherFunc);或element.onEventType = fatherFunc;，this指向DOM元素。"}}
{"actor":{"display_login":"LSYY888"}}