bitovi / bitovi/react-to-web-component

How about supporting object depth when using function properties?

Open
#167 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
944
Forks
52
PR merge metrics
No merged PRs in 30d

Description

A namespace is needed because your plugin uses a global function.

In the current structure, only window 1depth objects can be registered.
```javascript
parse: (value, attribute, element) => {
const fn = (() => {
if (typeof window !== "undefined" && value in window) {
// @ts-expect-error
return window[value] // only window 1depth objects can be registered!!
}

if (typeof global !== "undefined" && value in global) {
// @ts-expect-error
return global[value]
}
})()

return typeof fn === "function" ? fn.bind(element) : undefined
},
```

It would be nice to modify this part so that it can be defined as N depth.

```html
( O )
( X )
( X )
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the parse function shown in the issue and inspect how the func attribute value is resolved from window or global. Support the dotted examples such as ns.action and ns.action.get while preserving binding to the element, then verify that the one-level action case still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.