VIEW017: message-handler-never-receives
Message handler listens to no scope
| Code | VIEW017 |
| Name | message-handler-never-receives |
| Category | View structure (VIEW) |
| Default severity | warning |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports a component message handler whose pageScope, sessionScope and
viewScope are all false. Handlers where a flag is missing are not
reported.
Why is this bad?
Section titled “Why is this bad?”system.perspective.sendMessage delivers a message to the handlers that
listen to the scope it is sent in. A handler that listens to no scope never
receives anything, so its script is dead code; usually a scope checkbox was
unticked by mistake.
Example
Section titled “Example”{"messageType": "refresh", "pageScope": false, "sessionScope": false, "viewScope": false, "script": "\tself.refreshBinding('props.data')"}Use instead:
{"messageType": "refresh", "pageScope": true, "sessionScope": false, "viewScope": false, "script": "\tself.refreshBinding('props.data')"}Generated from the rule metadata by iglint generate-docs; iglint rule VIEW017 prints the same page in the terminal. Source: docs/rules/VIEW017.md.