runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
500 stars 61 forks source link

Polymer analyzer: add event parsing when a property is defined with notify true #250

Open jpradelle opened 1 year ago

jpradelle commented 1 year ago

Analysis of Polymer custom components doesn't report Polymer events of properties with notify: true attribute.

This pull request adds it according to documentation: https://polymer-library.polymer-project.org/3.0/docs/devguide/data-system#change-events

Example of analyzed source ```js import {PolymerElement, html} from '@polymer/polymer/polymer-element'; /** * @polymer * * @fires test-event {CustomEvent<{foo: string}>} - Demo test event */ export class PolymerTest extends PolymerElement { static get properties() { return { fooBar: { type: String, notify: true }, testType: { type: String } }; } static get template() { return html`

Hello

`; } } customElements.define('polymer-test', PolymerTest); ```
Markdown result with pull request code # polymer-test ## Events | Event | Type | Description | |-------------------|------------------------------------------|------------------------------------------| | `foo-bar-changed` | `CustomEvent<{value: *, path: ?string}>` | Fired when the `fooBar` property changes | | `test-event` | `CustomEvent<{foo: string}>` | Demo test event |
Markdown result without pull request code ## Events | Event | Type | Description | |-------------------|------------------------------------------|------------------------------------------| | `test-event` | `CustomEvent<{foo: string}>` | Demo test event |