You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Collect the VIN for each vehicle on the page in an array.
@@ -219,7 +219,9 @@ The insert method allows you to append markup to specific locations on some page
219
219
220
220
When activated, `API.insert` will call the callback function you define with the `elem` and `meta` parameters. It will call this for each relevant location on the page. For example, if you specify `vehicle-media` as the location and you are viewing a search results page with 30 vehicles, the callback function you define on `API.insert` will be called 30 times, once per vehicle, with the relevant location and vehicle data in the payload.
221
221
222
-
This acts as an event subscription, so as the application displays new vehicles dynamically (a single page application), new events are fired and your callback is automatically called for each of those new items. This works well for a basic use case where you want to place content on every item having the target location, or every item matching specific criteria available to you in the callback payload. If you need to execute additional code before determining if you wish to insert content, such as calling an external service, you should use the `insertOnce` method instead.
222
+
This acts as an event subscription, so as the application displays new vehicles dynamically (a single page application), new events are fired and your callback is immediately called for each of those new items. This works well for a basic use case where you want to place content on every item having the target location, or every item matching specific criteria available to you in the callback payload.
223
+
224
+
If you need to execute additional code before determining if you wish to insert content, such as calling an external service, you should use the `insertOnce` method instead in combination with the `vehicle-data-updated-v1` event as shown in the example here.
223
225
224
226
## API.insertOnce(name, callback(elem, meta))
225
227
@@ -228,9 +230,13 @@ This acts as an event subscription, so as the application displays new vehicles
228
230
```javascript
229
231
(function(WIAPI) {
230
232
varAPI=newWIAPI('test-integration'); // Note: Replace 'test-integration' with your actual integration identifier.
0 commit comments