zouhir / preact-habitat

Zero configuration Preact widgets renderer in any host DOM
MIT License
518 stars 43 forks source link

Exposing reference to the Widget through an optional variable #33

Open sirphoenix opened 5 years ago

sirphoenix commented 5 years ago

Adds a new "component" parameter to the render() function which can be either a string or object.

When passing a string like 'foo' the reference will be set to window[foo]. When passing an object it will set its property 'ref' to the widgets reference.

Also made some code cleanup since there were no eslint-settings to be found.

viperfx commented 4 years ago

@sirphoenix can these changes be used to make a widget that can show/hide based on a click's on the host element?