Xojo for Javascript Developers

As a former Xojo user and now a Node.js/ Javascript developer I would like to post this question (specially for Ricardo Cruz).
Can Xojo Web use plain Javascript Components?
What would it take to include them in Xojo Web?

Having the ability to include Javascript Web Components into Xojo, in my opinion, will definitely increase the capabilities of Xojo Web.

Please guys pass this message to Ricardo Cruz.

Ricardo, estaria interesado en platicar contigo o hacer un test en como implementarlos. Creo que las oportunidades serian inmensas para Xojo Web. Pero a lo mejor no es el camino que Xojo quiere, tecnologicamente hablando.

Maybe what are you looking for is the WebSDK?

Here is a post with a video:

1 Like

That is where the idea came from. To be honest it seems a little more complicated than creating it in Javascript, thus the question.
There are thousands of already created and free to use web components, imagine if we are able to include those in Xojo Web easily.
Here is one of the many free components.
Free components

I have seen some Xojo Web developers create WebSDK controls from free JS components.
They say it is not hard but they know JS and understand what Xojo needs for the WebSDK.

Edit: and you can ping @Ricardo_Cruz and he may comment if he is available.
If you have a Feature Request, then you can create an Issue in https://xojo.com/issues

What advantages would it have over a framework like Bootstrap?

Do not use free components imply risk?

1 Like

The advantages are:

  1. you are not tied to a framework
  2. Since it is plain Javascript no need to download any frameworks.

Frameworks nowdays is a hot topic in the Javascript world. Everything in life is like a pendulum., same in the Javascript world. Not long ago Single Page Applications (SPA) used to rule the world, now we are going back to where we started (server side).

I hate to break it to you but Goat UI is a framework.

Put a script tag similar to this <script type="module" src="https://unpkg.com/@goatui/components@0.10.8/dist/goatui/goatui.esm.js"></script>

2 Likes

I have wrapped many JavaScript libraries and components in GraffitiSuite Web Edition using the WebSDK. It’s doable, and not overly difficult if you know both JavaScript and Xojo.

7 Likes

I’ve made a few tests with React and it works just fine, using the Web SDK. I’m pretty sure it should be even easier with vanilla Web Components, the only problem is browser compatibility seems to be a bit low.

If you plan to build your own Web Components, take a look at Stencil JS, it should make things a bit easier.

I’ll more than happy to prepare an example or two using Web Components, as soon as I come back from my parental leave :baby:t3:

10 Likes

No idea you had been pregnant! I couldn’t tell haha :slight_smile:
Felicidades!

3 Likes

One day you’re aligning layers with CSS… and the next one you find yourself changing diapers :sweat_smile:

Mario has prepared a Web Component based on the TextArea with counter example:

Web Component:

Web SDK example:

I’ll prepare the example as soon as I come back. But if anybody wants to help and adapt Mario’s Web Component to the Web SDK, that would be epic. :blush:

2 Likes

Here are my thoughts on Plain Web Components

  1. You are not “tied” to a framework/Library
  2. These creates “Shadow web components” which are much faster then Virtual DOMs components.
  3. All CSS is encapsulated (meaning they only affect the component not the html page or other components)
  4. The class that you use to create the components is probably 80% the same. The only thing that changes are how you want to handle the callbacks.

I am not well versed on the WebSDK, but I can only wonder if Xojo Web can become a product where it can bring developers at the level of Javascript developers.

Here are my thoughts on what it would required:

  1. Implement in Xojo an easy GUI to create Plain Web Components.
  2. Make it easy to bring already created Web components. Most of the time is a file import in the HTML.
  3. Make it easy to catch the events of the components so we can handle them using Xojo code.

Anyways, this is just food for thought.

2 Likes

These two are tied together. The problem is that the Xojo IDE has no way to “know” what would run better on the browser vs sending the method call all the way back to the server, not to mention what calls could be done asynchronously.

You really ought to look at the WebSDK though. The whole point was to make it easy for developers to add their own controls to the Xojo ecosystem and a generic control is less than 20 lines of wrapper code. I think you’d find that most of what you’re asking for is already there… including the ability to draw your controls right in the IDE editor.

Hi @Mario_Prieto,

I’ve wrapped the Web Component you’ve created into a Web SDK control. I didn’t have to touch your code, but I’ve added a “text changed” event, so you can also control it from Xojo code.

Here it is:

I hope that helps.

1 Like