External Javascript defer loading

Hello

I’m quite new to Servoy NG, so this may be a stupid question. However, I try to achieve that a specific external .js-file is loaded after the page has loaded. In HTML I would do that like this:

<script defer src="https://code.whatever.com/external-file.min.js"></script>

How can this be done in NG-client? Thanks in advance!

Regards

Tom

thats not directly possible

Or you have to have your own servoy ngclient service that injects that script tag with that defer when your service is loaded
Then i guess it will really be lazy.

What do you want to do with that external js once it is loaded? Why is “lazy” loading important for you?

Hi Patrick

I’d like to ‘pimp’ my interface. The lazy loading is needed for extra functionality (more as in ‘visual effects’). I use a library for this: https://getmdl.io

In the first place I am a webdesigner, forced to use Servoy. I still have difficulties to fully understand how Servoy renders the webpage, and how to adapt the interface to my wishes. I’m still thinking as a webdesigner… :?

Grtz

Tom

From shortly looking at this, I think the best would be to build web components for specific UI elements you would like to use. See https://wiki.servoy.com/display/DOCS/WebComponents for an overview.

i don’t get why you use lazy loading for?
Is that just to depend on a the visual affect that happens when it is lazy loaded? (so it is completely depending on the browsers and fast speed of the internet connection of the user?)
That looks very weird to me to depend on that
i think that defer is just a speed up. If you know that library is not used right away but only later on (and the creating of the dom doesn’t depend on it) then you can do defer so the browser doesn’t block on the load.
So for me it is a performances thing not something useful for anything else, but i could be wrong

tom:
I’d like to ‘pimp’ my interface. The lazy loading is needed for extra functionality (more as in ‘visual effects’). I use a library for this: https://getmdl.io

In the first place I am a webdesigner, forced to use Servoy. I still have difficulties to fully understand how Servoy renders the webpage, and how to adapt the interface to my wishes. I’m still thinking as a webdesigner… :?

Yes. That package wouldn’t work for you anyway. Its really meant for static sites. See their note about “Use MDL on dynamic websites”. Servoy updates content dynamically, so that would be a nightmare.

You should still think like a webdesigner, but it needs a bit of tweaking. Servoy has Bootstrap components available (labeled as the 12grid package). So as you place your elements on the interface, you can assign multiple CSS classes and use what comes in Bootstrap, and of course add your own CSS style sheet. Personally, I sometimes start with this site: http://bootstrap-live-customizer.com/ . You can generate your Booststrap theme or choose from some defaults. Click download and get the .css version and paste that into your CSS your using for your solution. That gets a base theme started for you.

I’m teaching a training in CA in a couple of weeks mostly on building nice interfaces in Servoy 8, so I’ll try to put together something I can share.

Thanks for all the input! A day without learning is a day wasted :D

Very excited to dive into the web components. Together with the base Bootstrap theme provided, I will definitely make some progress on this issue.

John, if you’re able to share some info from your training, that would be wonderful! Thanks in advance, and long live the internet.

Have a nice weekend you all,

Tom