{"action":"created","issue":{"url":"https://api.github.com/repos/DDMAL/Pixel.js/issues/43","repository_url":"https://api.github.com/repos/DDMAL/Pixel.js","labels_url":"https://api.github.com/repos/DDMAL/Pixel.js/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/DDMAL/Pixel.js/issues/43/comments","events_url":"https://api.github.com/repos/DDMAL/Pixel.js/issues/43/events","html_url":"https://github.com/DDMAL/Pixel.js/issues/43","id":229776875,"number":43,"title":"Function passed to Diva.Events.subscribe cannot access properties or methods of the class","user":{"login":"zeyadhazem","id":6385466,"avatar_url":"https://avatars2.githubusercontent.com/u/6385466?v=3","gravatar_id":"","url":"https://api.github.com/users/zeyadhazem","html_url":"https://github.com/zeyadhazem","followers_url":"https://api.github.com/users/zeyadhazem/followers","following_url":"https://api.github.com/users/zeyadhazem/following{/other_user}","gists_url":"https://api.github.com/users/zeyadhazem/gists{/gist_id}","starred_url":"https://api.github.com/users/zeyadhazem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeyadhazem/subscriptions","organizations_url":"https://api.github.com/users/zeyadhazem/orgs","repos_url":"https://api.github.com/users/zeyadhazem/repos","events_url":"https://api.github.com/users/zeyadhazem/events{/privacy}","received_events_url":"https://api.github.com/users/zeyadhazem/received_events","type":"User","site_admin":false},"labels":[{"id":598721527,"url":"https://api.github.com/repos/DDMAL/Pixel.js/labels/bug","name":"bug","color":"ee0701","default":true},{"id":604001167,"url":"https://api.github.com/repos/DDMAL/Pixel.js/labels/Component:%20Core","name":"Component: Core","color":"0e8a16","default":false},{"id":604000816,"url":"https://api.github.com/repos/DDMAL/Pixel.js/labels/Component:%20Plugins","name":"Component: Plugins","color":"5319e7","default":false},{"id":598721530,"url":"https://api.github.com/repos/DDMAL/Pixel.js/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true},{"id":598890379,"url":"https://api.github.com/repos/DDMAL/Pixel.js/labels/Priority:%20High","name":"Priority: High","color":"b60205","default":false},{"id":598721532,"url":"https://api.github.com/repos/DDMAL/Pixel.js/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-05-18T19:17:47Z","updated_at":"2017-05-20T00:27:11Z","closed_at":"2017-05-18T23:23:23Z","body":"Basically if we're inside, we cannot use the keyword \"this\" to access any properties or methods of the instance of the class. This might be happening because the subscription is only called once (wether in the constructor or inside a method) so no continuous update (kind of stuck in the when it was called)\r\n\r\nMaybe the fix should be that some other entity outside of the plugin subscribes to that event and then calls the methods inside to plugin to perform the change?"},"comment":{"url":"https://api.github.com/repos/DDMAL/Pixel.js/issues/comments/302838152","html_url":"https://github.com/DDMAL/Pixel.js/issues/43#issuecomment-302838152","issue_url":"https://api.github.com/repos/DDMAL/Pixel.js/issues/43","id":302838152,"user":{"login":"zeyadhazem","id":6385466,"avatar_url":"https://avatars2.githubusercontent.com/u/6385466?v=3","gravatar_id":"","url":"https://api.github.com/users/zeyadhazem","html_url":"https://github.com/zeyadhazem","followers_url":"https://api.github.com/users/zeyadhazem/followers","following_url":"https://api.github.com/users/zeyadhazem/following{/other_user}","gists_url":"https://api.github.com/users/zeyadhazem/gists{/gist_id}","starred_url":"https://api.github.com/users/zeyadhazem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeyadhazem/subscriptions","organizations_url":"https://api.github.com/users/zeyadhazem/orgs","repos_url":"https://api.github.com/users/zeyadhazem/repos","events_url":"https://api.github.com/users/zeyadhazem/events{/privacy}","received_events_url":"https://api.github.com/users/zeyadhazem/received_events","type":"User","site_admin":false},"created_at":"2017-05-20T00:27:11Z","updated_at":"2017-05-20T00:27:11Z","body":"I passed an instance of the class to the subscriber method, the following way\r\n```\r\nsubscribeToEvent(highlighted){\r\n        let instance = this;\r\n\r\n        let handle = Diva.Events.subscribe('VisibleTilesDidLoad', function(args){\r\n            instance.drawHighlights(highlighted, args);\r\n        });\r\n        return handle;\r\n    }\r\n```\r\nThis is the entry point to the plugin from the subscriber. Everywhere else in the code I can use the keyword \"this\" with no problem"}}
{"actor":{"display_login":"zeyadhazem"}}