Control JS Load Order (Before/After SpiderBasic Libraries)

Got an idea for enhancing SpiderBasic? New command(s) you'd like to see?
skinkairewalker
Posts: 125
Joined: Tue Jun 14, 2016 7:17 pm

Control JS Load Order (Before/After SpiderBasic Libraries)

Post by skinkairewalker »

Hey everyone,

I’d like to suggest a feature that could really improve flexibility when integrating external JavaScript libraries with SpiderBasic.

As it stands, external JS files seem to be loaded after SpiderBasic’s internal libraries. However, some libraries
example : especially rendering engines like Babylon.js (need to be loaded before in order to work properly, since other parts of the app may depend on them being available during initialization ) .

Suggestion:
Add an option/configuration to control when external JS files are loaded:

Code: Select all

something like this

HeaderSection.a << ---- a == After
<meta name="description" content="babylon.js">
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<canvas id="renderCanvas"></canvas>
EndHeaderSection

HeaderSection.b << ----- b == Before
<meta name="description" content="babylon.js">
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<canvas id="renderCanvas"></canvas>
EndHeaderSection

Before SpiderBasic libraries
After SpiderBasic libraries (current behavior)

This could be implemented as a simple flag when including scripts, or as a project-level setting.

Benefits:

Better compatibility with modern JS libraries
More control over initialization order
Easier integration with external frameworks and engines

I believe this would open up a lot of possibilities for developers using SpiderBasic alongside other technologies.

Do you think this would be useful?
User avatar
Danilo
Posts: 59
Joined: Wed Feb 26, 2014 7:11 am

Re: Control JS Load Order (Before/After SpiderBasic Libraries)

Post by Danilo »

Controlling the order is a good idea. Maybe a priority system.

Code: Select all

IncludeJS „file.js“ [, optionalPriority]

IncludeJS „file.js“, 1
XIncludeJS „file2.js“, 501
SB libs are at priority 500. Priority <500 is loaded before SB libs, Priority >500 after.

Could there be an option to exclude the Dojo/GUI system entirely,
to get only the SB base system? Like a „SB console mode“.
Plain SB/JS/HTML coding without including all the SB GUI libs?

Just using plain Babylon.js, Three.js and other 3rd-party libs, excluding the SB GUI.
cya,
...Danilo
Post Reply