Replies: 1 comment
-
Done, and some parts undoned by #393 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, the main way to create a RAMP instance on a page is to include a
is="rv-map"
node somewhere on the page, before the main RAMP script is loaded:As the script loads, it searches the page for
is="rv-map"
elements and turns them into map instances. Alternatively (I think), you can create a map instance through the RAMP API.Do we want to keep this auto-initialization behaviour or explicitly require the page to initialize all RAMP instances manually through the API?
Dropping auto-initialization has some benefits:
This might look something like:
This works, but the script initializing a RAMP instance needs to be included after the script tag loading the main RAMP file. This can be annoying in some cases, especially when webpack injection is used as it will often injects script tags at the very bottom of the file, breaking the above order.
To avoid manually waiting for the script to load like this:
the main RAMP script can automatically call a specific global function (
rampOnLoad
for example) after loading, if it's available. This function, in turn, can initialize RAMP instances as it pleases:This callback function needs to be defined before the main RAMP script is loaded, but this seems to be more easily managed than the reverse.
What do you think?
Further questions
Beta Was this translation helpful? Give feedback.
All reactions