{"action":"created","issue":{"url":"https://api.github.com/repos/box/t3js/issues/172","repository_url":"https://api.github.com/repos/box/t3js","labels_url":"https://api.github.com/repos/box/t3js/issues/172/labels{/name}","comments_url":"https://api.github.com/repos/box/t3js/issues/172/comments","events_url":"https://api.github.com/repos/box/t3js/issues/172/events","html_url":"https://github.com/box/t3js/issues/172","id":154579912,"number":172,"title":"Box.Context and Box.TestServiceProvider have incorrect constructor properties set to Object","user":{"login":"aplatti","id":108964,"avatar_url":"https://avatars.githubusercontent.com/u/108964?v=3","gravatar_id":"","url":"https://api.github.com/users/aplatti","html_url":"https://github.com/aplatti","followers_url":"https://api.github.com/users/aplatti/followers","following_url":"https://api.github.com/users/aplatti/following{/other_user}","gists_url":"https://api.github.com/users/aplatti/gists{/gist_id}","starred_url":"https://api.github.com/users/aplatti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aplatti/subscriptions","organizations_url":"https://api.github.com/users/aplatti/orgs","repos_url":"https://api.github.com/users/aplatti/repos","events_url":"https://api.github.com/users/aplatti/events{/privacy}","received_events_url":"https://api.github.com/users/aplatti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-12T20:58:10Z","updated_at":"2016-05-13T18:51:02Z","closed_at":null,"body":"Hi T3! \r\n\r\nI'm running into an issue in my project that is caused by subtle problem with the way that Box.Context and Box.TestServiceProvider are defined.  The methods on those objects are set by completely replacing  the prototype properties with a new object, which causes the constructor property to become Object, instead of the correct Box constructor functions.\r\n\r\nThe current code defines the methods on these object like this:\r\n\r\n```\r\n\tfunction Context(application, element) {\r\n\t\tthis.application = application;\r\n\t\tthis.element = element;\r\n\t}\r\n\r\n\tContext.prototype = {\r\n\t\tbroadcast: function(name, data) {...},\r\n\t\tgetService: function(serviceName) {...},\r\n\t\t...\r\n\t}\t\r\n```\r\n\r\nBecause the prototype is replaced by `{}`, the constructor becomes object.\r\n\r\nThe fix is simple:\r\n\r\n```\r\n\tfunction Context(application, element) {\r\n\t\tthis.application = application;\r\n\t\tthis.element = element;\r\n\t}\r\n\r\n\tContext.prototype.broadcast: function(name, data) {...};\r\n\tContext.prototype.getService: function(serviceName) {...};\r\n\t...\r\n```\r\n\r\nI'm happy to create a PR, but just wanted to run it by you guys first for feedback.  \r\n\r\nThanks!\r\nAdam\r\n"},"comment":{"url":"https://api.github.com/repos/box/t3js/issues/comments/219129107","html_url":"https://github.com/box/t3js/issues/172#issuecomment-219129107","issue_url":"https://api.github.com/repos/box/t3js/issues/172","id":219129107,"user":{"login":"j3tan","id":2489149,"avatar_url":"https://avatars.githubusercontent.com/u/2489149?v=3","gravatar_id":"","url":"https://api.github.com/users/j3tan","html_url":"https://github.com/j3tan","followers_url":"https://api.github.com/users/j3tan/followers","following_url":"https://api.github.com/users/j3tan/following{/other_user}","gists_url":"https://api.github.com/users/j3tan/gists{/gist_id}","starred_url":"https://api.github.com/users/j3tan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j3tan/subscriptions","organizations_url":"https://api.github.com/users/j3tan/orgs","repos_url":"https://api.github.com/users/j3tan/repos","events_url":"https://api.github.com/users/j3tan/events{/privacy}","received_events_url":"https://api.github.com/users/j3tan/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T18:51:02Z","updated_at":"2016-05-13T18:51:02Z","body":"Hi Adam,\r\n\r\nI think the changes you proposed are perfectly fine and a PR would be most helpful!"}}