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

Can I access DOM object by vugu's method instead of syscall/js package ? #65

Open
itstmyi opened this issue Aug 6, 2019 · 11 comments
Open
Labels
question Further information is requested

Comments

@itstmyi
Copy link

itstmyi commented Aug 6, 2019

I have read this post : #49 . That post was closed .

Any new progress or plan about accessing DOM object by vugu's local/native method instead of invoking syscall/js package ? For example , fetch values from text or selection box element ( in root.vugu file) and invoke some APIs according to values of these input or selection box .

Thanks .

@bradleypeabody
Copy link
Contributor

This is still being worked on. See comment #49 (comment) . Look out for an update on this soon and I'll definitely be sure to clearly document what this mechanism is as soon as it is ready.

@itstmyi
Copy link
Author

itstmyi commented Aug 9, 2019

Thanks for hard working .

@itstmyi
Copy link
Author

itstmyi commented Aug 15, 2019

I have tested multi-component structure(root/child/child of child in 3 vugu files) . It worked perfectly on passsing/relaying parameters from root component .
When the root component is initialized , I can pass/relay values to the deepest component or redraw the component by newdata method to update the component .
There is still no simple way to get DOM value(content of text box or select box) without invoking syscall/js . New samples about these operations would be interesting and attractive .

Sorry for disturbing your busy developing .Good job .

@bradleypeabody
Copy link
Contributor

That's great! Yeah the event work is still ongoing but getting much closer now. Still a couple weeks out from merging into master though. But soon.

@bradleypeabody bradleypeabody added the question Further information is requested label Aug 25, 2019
@bradleypeabody
Copy link
Contributor

I'm not sure how much this solves what you're referring to above, but have a look at: https://github.com/vugu/vugu/wiki/Refactor-Notes---Sep-2019#new-and-improved-dom-event-handling

It doesn't give you access to the raw DOM element, but it does give you data about it collected in JS and made available to you in Go.

@JalonSolov
Copy link

For accessing the DOM, there are at least these 2 projects:

https://github.com/dennwc/dom
https://github.com/dominikh/go-js-dom

@itstmyi
Copy link
Author

itstmyi commented Dec 15, 2019

Thanks for your information .

@bradleypeabody
Copy link
Contributor

What would be really helpful is if someone could describe what syntax/features would be useful as a developer to implement. You can access the DOM from a Vugu program using the syscall/js package very easily, but Vugu modifies that DOM during render - so it is not safe to keep references to DOM elements in your code.

An example that shows how you would expect to use DOM access would allow us to discuss the pros and cons thereof.

@itstmyi
Copy link
Author

itstmyi commented Dec 16, 2019

That's right . I think accessing DOM by vugu's interface would be safe and enough now.

@bradleypeabody
Copy link
Contributor

A new feature has been added for this. You can now get a js.Value for an element when it is rendered (this can be used for example to draw into a canvas). See https://www.vugu.org/doc/files/markup#vg-js-create

@itstmyi
Copy link
Author

itstmyi commented May 7, 2020

good job . thanks for your hard working these days .

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

No branches or pull requests

3 participants