Javascript / Events References

Should you require to do further modification to the main widget which involves Javascript, you may have to use Stamped.io's listening event to run the codes after the widget is loaded.


In This Guide


Adding The Listening Event Code

Add this JS function for listening to events fired by Stamped.io

function addEventListenerStamped(el, eventName, handler) { 
   if (el.addEventListener) { el.addEventListener(eventName, handler); }
   else { el.attachEvent('on' + eventName, function () { handler.call(el); }); } 
}

// Listening for event
addEventListenerStamped(document, '##replaceWithEventName##', function(e) {
  console.log(e);
});

// Example
// Listening for reviews widget loaded event
addEventListenerStamped(document, 'stamped:reviews:loaded', function(e) {
  console.log(e);
});

Events

Event Name Fired When
stamped:reviews:loaded Product Reviews widget loaded

Still need help? Contact Us Contact Us