{"action":"created","issue":{"url":"https://api.github.com/repos/processing/p5.js/issues/2025","repository_url":"https://api.github.com/repos/processing/p5.js","labels_url":"https://api.github.com/repos/processing/p5.js/issues/2025/labels{/name}","comments_url":"https://api.github.com/repos/processing/p5.js/issues/2025/comments","events_url":"https://api.github.com/repos/processing/p5.js/issues/2025/events","html_url":"https://github.com/processing/p5.js/issues/2025","id":238360120,"number":2025,"title":"Accessing elements via event listeners attached to functions","user":{"login":"radialBlur050116","id":29684767,"avatar_url":"https://avatars3.githubusercontent.com/u/29684767?v=3","gravatar_id":"","url":"https://api.github.com/users/radialBlur050116","html_url":"https://github.com/radialBlur050116","followers_url":"https://api.github.com/users/radialBlur050116/followers","following_url":"https://api.github.com/users/radialBlur050116/following{/other_user}","gists_url":"https://api.github.com/users/radialBlur050116/gists{/gist_id}","starred_url":"https://api.github.com/users/radialBlur050116/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radialBlur050116/subscriptions","organizations_url":"https://api.github.com/users/radialBlur050116/orgs","repos_url":"https://api.github.com/users/radialBlur050116/repos","events_url":"https://api.github.com/users/radialBlur050116/events{/privacy}","received_events_url":"https://api.github.com/users/radialBlur050116/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-25T04:57:34Z","updated_at":"2017-06-25T10:55:42Z","closed_at":null,"body":"<!--\r\nHi there! If you are here to report a bug, or to discuss a feature (new or existing), you can use the below template to get started quickly. Fill out all those parts which you're comfortable with, and delete the remaining ones.\r\n\r\nTo check any option, replace the space between the \"[\" and \"]\" with a \"x\".\r\nFeel free to remove any portion of the template that is not relevant for your issue.\r\n-->\r\n\r\n#### Nature of issue?\r\n\r\n- [ ] Found a bug\r\n- [ ] Existing feature enhancement\r\n- [ ] New feature request\r\n\r\n#### Most appropriate sub-area of p5.js?\r\n\r\n- [ ] Color\r\n- [x ] Core\r\n- [ ] Events\r\n- [ ] Image\r\n- [ ] IO\r\n- [ ] Math\r\n- [ ] Typography\r\n- [ ] Utilities\r\n- [ ] WebGL\r\n\r\n#### Which platform were you using when you encountered this?\r\n\r\n- [ ] Mobile/Tablet (touch devices)\r\n- [x ] Desktop/Laptop\r\n- [ ] Others (specify if possible)\r\n\r\n\r\n<!-- If you want to enhance an existing feature, please describe here -->\r\n#### Feature enhancement details:\r\n\r\nThere might already be a way to do this, but I have a single method attached to several elements via event listeners and it would be awesome if there were a way to determine which element the method was accessed from.  I know there are easy ways to do it in native js, but after searching through the core sub-area, the farthest I got was finding where the element was bound to the function:\r\n```\r\nfunction attachListener(ev, fxn, ctx) {\r\n  var f = fxn.bind(ctx);\r\n  ctx.elt.addEventListener(ev, f, false);\r\n  ctx._events[ev] = f;\r\n}\r\n```\r\nSince the element is bound to the function and not the other way around, it seems like there should be a way to access a single method's bound elements?"},"comment":{"url":"https://api.github.com/repos/processing/p5.js/issues/comments/310895939","html_url":"https://github.com/processing/p5.js/issues/2025#issuecomment-310895939","issue_url":"https://api.github.com/repos/processing/p5.js/issues/2025","id":310895939,"user":{"login":"limzykenneth","id":7543950,"avatar_url":"https://avatars0.githubusercontent.com/u/7543950?v=3","gravatar_id":"","url":"https://api.github.com/users/limzykenneth","html_url":"https://github.com/limzykenneth","followers_url":"https://api.github.com/users/limzykenneth/followers","following_url":"https://api.github.com/users/limzykenneth/following{/other_user}","gists_url":"https://api.github.com/users/limzykenneth/gists{/gist_id}","starred_url":"https://api.github.com/users/limzykenneth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limzykenneth/subscriptions","organizations_url":"https://api.github.com/users/limzykenneth/orgs","repos_url":"https://api.github.com/users/limzykenneth/repos","events_url":"https://api.github.com/users/limzykenneth/events{/privacy}","received_events_url":"https://api.github.com/users/limzykenneth/received_events","type":"User","site_admin":false},"created_at":"2017-06-25T10:55:42Z","updated_at":"2017-06-25T10:55:42Z","body":"I may have misunderstood you but when a method is called with the context bound, it means you can access the caller context in said method through the `this` keyword, which should give you what you are looking for."}}
{"actor":{"display_login":"limzykenneth"}}