You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 26, 2022. It is now read-only.
Does the component avoid exposing internal members in its public API?
A component should only expose methods and properties in its public API that are intended for use by page authors. Exposing methods and properties that are only intended for internal use can be confusing to page authors, and also encourage them to rely on internals that you may want to change over time.
Generally speaking, methods and properties exposed with string names are trivially easy for page authors to discover, e.g., in a browser's debug console. Even if you try to signal that a member is private by prefixing its name with an underscore (_foo), page authors will still find such members, and despite your intentions come to depend on them.
There are a variety of alternatives in JavaScript for hiding members from a component's public API:
Identify internal members with Symbol keys instead of string names.
Use JavaScript module scoping to keep internal members hidden outside the module that defines the component.
Use JavaScript function closures to hide internal members.
Store private data on element instances using a WeakMap.