{"action":"closed","issue":{"url":"https://api.github.com/repos/ractivejs/ractive/issues/3219","repository_url":"https://api.github.com/repos/ractivejs/ractive","labels_url":"https://api.github.com/repos/ractivejs/ractive/issues/3219/labels{/name}","comments_url":"https://api.github.com/repos/ractivejs/ractive/issues/3219/comments","events_url":"https://api.github.com/repos/ractivejs/ractive/issues/3219/events","html_url":"https://github.com/ractivejs/ractive/issues/3219","id":309054067,"node_id":"MDU6SXNzdWUzMDkwNTQwNjc=","number":3219,"title":"context.hasListener() example/usage","user":{"login":"ceremcem","id":6639874,"node_id":"MDQ6VXNlcjY2Mzk4NzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/6639874?v=4","gravatar_id":"","url":"https://api.github.com/users/ceremcem","html_url":"https://github.com/ceremcem","followers_url":"https://api.github.com/users/ceremcem/followers","following_url":"https://api.github.com/users/ceremcem/following{/other_user}","gists_url":"https://api.github.com/users/ceremcem/gists{/gist_id}","starred_url":"https://api.github.com/users/ceremcem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceremcem/subscriptions","organizations_url":"https://api.github.com/users/ceremcem/orgs","repos_url":"https://api.github.com/users/ceremcem/repos","events_url":"https://api.github.com/users/ceremcem/events{/privacy}","received_events_url":"https://api.github.com/users/ceremcem/received_events","type":"User","site_admin":false},"labels":[{"id":102238673,"node_id":"MDU6TGFiZWwxMDIyMzg2NzM=","url":"https://api.github.com/repos/ractivejs/ractive/labels/inquiry/pending%20clarification","name":"inquiry/pending clarification","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-27T17:01:44Z","updated_at":"2018-06-18T17:46:57Z","closed_at":"2018-06-18T17:46:57Z","author_association":"NONE","body":"## Description:\r\n\r\nCurrently, `ractive.hasListener('foo')` [does not behave](https://ractive.js.org/playground/?env=docs#N4IgFiBcoE5SBTAJgcwSAvgGhAZ3gHYIDuABAEoCGAxgC4CWAbggBTAA6B7tCANpKQDkAIwD2SAJ6C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HaNjbxY+CYGJaEuzRaYPiB+WNRhN9um3mdC9sC8FK697Da9J60pyKkh5qyKPx72eSjJDB2iJYeuD3vd6ddxgOiYEAA): \r\n\r\n```js\r\nnew Ractive({\r\n  el: 'body',\r\n  template: `\r\n    <foo on-bar=\"baz\">hello</foo>       <!-- has listener -->\r\n    <foo on-bar=\"nonexist\">hello</foo>  <!-- has listener -->\r\n    <foo>hello</foo>                    <!-- does not have listener -->\r\n  `,\r\n  components:{\r\n    foo: Ractive.extend({\r\n      template: `<button on-click=\"bar\">{{>content}}</button>`,\r\n      onrender: function(){\r\n        if (this.hasListener('bar')){\r\n          alert('component has on-bar=... listener!')\r\n        }\r\n      }\r\n    })\r\n  },\r\n  on:{\r\n    baz: function(ctx){\r\n      alert('hello from baz!')\r\n    }\r\n  }\r\n})\r\n\r\n```\r\n...gives the following exception: \r\n\r\n```\r\nUncaught TypeError: this.hasListener is not a function\r\n    at Child.onrender (script.js:12)\r\n    at Hook.fire (ractive.js:6923)\r\n    at Array.<anonymous> (ractive.js:17905)\r\n    at flushChanges (ractive.js:5792)\r\n    at Object.end (ractive.js:5689)\r\n    at render$1 (ractive.js:17938)\r\n    at Ractive$render [as render] (ractive.js:17969)\r\n    at initialise (ractive.js:17866)\r\n    at new Ractive (ractive.js:18571)\r\n    at script.js:1\r\n```\r\n\r\n## Versions affected:\r\n\r\nEdge\r\n\r\n"}}
{"actor":{"display_login":"ceremcem"}}