Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Private/Internal events #126

Closed
kylewelsby opened this issue Nov 25, 2019 · 1 comment
Closed

Support for Private/Internal events #126

kylewelsby opened this issue Nov 25, 2019 · 1 comment

Comments

@kylewelsby
Copy link

kylewelsby commented Nov 25, 2019

I have come across a scenario where I would like to emit an event from a host element to a child element in reaction to something which is intended to be internal only and not display in the documented output.

Perhaps using the @private tag as referenced in #106

Example:

@customElement('testing')
export default class Testing extends LitElement {
  render() {
    return html`<child-element></child-element>`
  }
  firstUpdated() {
    let child = document.querySelector('child-element')
    setTimeout(() => {
      child.dispatchEvent(new CustomEvent('ping'))
    }, 1000)
  }
}

Expected:

omit eventName ping from the documentation.

@runem
Copy link
Owner

runem commented Nov 27, 2019

Hi Kyle, thanks for opening this issue and thanks for using WCA!

I agree that this is needed 👍 I have implemented it on the branch https://github.com/runem/web-component-analyzer/tree/refactor and is being tracked with the issue #125

In future you will be able to mark you events private or protected using jsdoc private like this:

@customElement('testing')
export default class Testing extends LitElement {
  render() {
    return html`<child-element></child-element>`
  }
  firstUpdated() {
    let child = document.querySelector('child-element')
    setTimeout(() => {
      /**
       * @private
       */
      child.dispatchEvent(new CustomEvent('ping'))
    }, 1000)
  }
}

I will close this issue when it has been released ☀️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants