webui-dev / nim-webui

Use any web browser as GUI, with Nim in the backend and HTML5 in the frontend.
https://webui.me
MIT License
130 stars 9 forks source link

[some request] tutorial/demo on interfacing 3rd javascript code #21

Open retsyo opened 1 year ago

retsyo commented 1 year ago

for example https://github.com/olifolkerd/tabulator https://github.com/jspreadsheet/ce

further, is it possible to interface 3rd javascript code without writing any js code?

thanks

delphius commented 1 year ago

Since webui is a mechanism for accessing the browser via web sockets, two-way data and event binding functions are available to you. Thus, you can write a backend wrapper library in your preferred programming language, using, for example, events and callbacks provided by tabulator , which will allow you to create, display and manage tables using all the features provided by this js library, without resorting directly to javascript programming. But, in any case, it will require initial work on writing a wrapper using, including javascript

retsyo commented 1 year ago

so bad, javascript is not my language

delphius commented 1 year ago

Please describe in general terms, using the example of some library, for example tabulator, how are you going to use it from your programming language? Or give an example of a similar ready-made solution, even if not in your preferred programming language, which can be taken as the basis of your use case.

delphius commented 1 year ago

further, is it possible to interface 3rd javascript code without writing any js code?

Possible approaches

AlbertShown commented 1 year ago

Tabulator and CE you provided are written in JavaScript. Using it will require JavaScript skills as well. Someone will probably create an example using those JavaScript plugins, but using WebUI generally requires Web skills.

neroist commented 1 year ago

further, is it possible to interface 3rd javascript code without writing any js code?

You could probably write Nim code, compile it to JS, then link the JS in the HTML code. For external libraries, you could wrap them and import functions with importc.

retsyo commented 10 months ago

I met htmx which seems to be successful in some projects by reducing JavaScript code. Will it be useful for nim-webui? I don't know since I know nothing about front-end programming

hassandraga commented 10 months ago

Thank you @retsyo for pointing this out. I guess HTMX is useful for end-user because this can reduce the need of JS in their apps. While WebUI itself does not provide/generate any HTML hypertext.