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

Add operation for attaching an already existing dom element. #18

Open
Olian04 opened this issue Oct 25, 2018 · 1 comment
Open

Add operation for attaching an already existing dom element. #18

Olian04 opened this issue Oct 25, 2018 · 1 comment
Labels
feature New feature or request new Supportive tag. Indicates that the issue describes something to be added. unfinished design

Comments

@Olian04
Copy link
Owner

Olian04 commented Oct 25, 2018

API:

const canvas = document.createElement('canvas');
render(_=>_
   .attach(canvas)
);

Implementation: (in buildNode)

const ctx: VNode = {
    tag: tagType,
    value: null,
    text: '',
    events: {},
    props: {},
    children: [],
    external: null, // <-----
};
const builderCtx: BuilderCTX = {
    attach(elem) {
        const child = newVNode({
            tag: elem.nodeName.toLowerCase(),
            external: elem,
        });
        ctx.children.push(child);
        return this;
    }
}
@Olian04 Olian04 added the feature New feature or request label May 8, 2019
@Olian04 Olian04 added the new Supportive tag. Indicates that the issue describes something to be added. label Jun 7, 2019
@Olian04
Copy link
Owner Author

Olian04 commented Jan 20, 2022

Might invert this. Changing it from attach to ref. Could help with SSR integration (#49).

let canvas;
render(_=>_
   .child('canvas', _=>_
      .ref({ canvas })
   )
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request new Supportive tag. Indicates that the issue describes something to be added. unfinished design
Projects
None yet
Development

No branches or pull requests

1 participant