addListener (JS API v2)

Version 2 API only.

addListener

Method Signature

void ultraCart.addListener(String event, function);

Description

Registers a function as a listener to an ultraCart event

Parameter

String event - the name of the event. Events are listed and discussed in the init() method documentation.

Parameter

function - a javascript function. The function will not be passed any parameters.

Result

no return value





function doSomethingWhenShippingChanges(){
    alert('shipping choice changed!');
}

ultraCart.addListener(ultraCart.events.EVENT_SHIPPING_CHANGE, doSomethingWhenShippingChanges);