[x3d-public] loadURL browser object SAI function proposal

Andreas Plesch andreasplesch at gmail.com
Mon May 28 12:59:47 PDT 2018


Table 7.3 list the browser object SAI functions for JS:

http://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/functions.html#t-FunctionsBrowserObject

So in order load a new scene from a URL into the current browser, one
first creates a new x3dscene from the URL and then replaces the
current world with the new scene.

John and I are adding these browser SAI functions more formally to
x3dom, along with supporting json as string, url, or object using
John's parser and expander. It works pretty well but it turned out to
be useful to add an additional function: loadURL(url).

It just just combines the two steps into one. Apart from addressing
the most common use case for these functions by making this easier,
loadURL also hides the asynchronous nature of downloading which is
strongly preferred these days. An app does not block while potentially
downloading slowly, or finally timing out. The function knows
internally when the download is available and then replaces the world.
In x3dom there is then another user definable function which is called
when the world is completely loaded. I think there is an equivalent
event in x3d. So the function is still asynchronous but allows for
familiar methods to proceed when the scene is available.

Practically, for x3dom users, having loadURL means not having to know
or learn Promises and still have a performant, and easy way to load a
new scene.

Here is an example which loads new scenes in various ways:
https://rawgit.com/x3dom/x3dom/browserSAI/test/functional/runtime.html#
The expanded world option loads remote json, after expanding protos.

My question is then if other x3d browser have such a convenience
loadURL SAI function, potentially asynchronous, and if there is an
informal standard to follow.

-Andreas

-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list