@splinetool/runtime 0.9.82 → 0.9.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -119,6 +119,35 @@ spline
119
119
 
120
120
  You can find a list of all of the Spline Events you can pass to the `emitEvent` function in the [Spline Events](#spline-events) section.
121
121
 
122
+ ### Preloading your scene
123
+
124
+ You might want to start the loading of `.splinecode` file before your code is loaded. It's possible using a [HTML preload Link tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload). Doing so will only save a little time by ensuring the spline file loading starts before your scripts are done loading. Since internally the `.splinecode` file will be loaded through a `fetch` call, you can do it like this :
125
+
126
+ ```HTML
127
+ <html>
128
+ <head>
129
+ <!--
130
+ add a preload link tag
131
+ with the scene your want to preload
132
+ at the end of your <head>
133
+ It needs to use the fetch preload type
134
+ -->
135
+ <link rel="preload" href="https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode" as="fetch"
136
+ </head>
137
+ ```
138
+
139
+ ```js
140
+ /*
141
+ When loading the Application, use the second
142
+ param of the load function to make sure the browser
143
+ will use the preloaded file and not make another request
144
+ */
145
+ spline.load('https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode', {
146
+ credentials: 'include',
147
+ mode: 'no-cors',
148
+ });
149
+ ```
150
+
122
151
  ## API
123
152
 
124
153
  ### Spline Application Methods