nim-webui icon indicating copy to clipboard operation
nim-webui copied to clipboard

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

Open retsyo opened this issue 1 year ago • 8 comments

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

retsyo avatar Jun 21 '23 02:06 retsyo

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

delphius avatar Jun 21 '23 03:06 delphius

so bad, javascript is not my language

retsyo avatar Jun 21 '23 08:06 retsyo

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 avatar Jun 21 '23 11:06 delphius

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

Possible approaches

delphius avatar Jun 22 '23 10:06 delphius

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.

AlbertShown avatar Jun 22 '23 19:06 AlbertShown

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.

neroist avatar Jul 03 '23 14:07 neroist

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

retsyo avatar Oct 27 '23 12:10 retsyo

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.

hassandraga avatar Oct 27 '23 14:10 hassandraga