Top Level MintChip API Objects

The MintChip browser plugin contains two main top level JavaScript objects that are used as entry points for the MintChip JavaScript API:

These objects cannot be created using JavaScript new operator, but rather are accessed as properties of the plugin object.

If the MintChip plugin object is defined in the HTML markup as it is shown in the previous code sample, then the top level MintChip API objects can be accessed as in the following example:

    var mintChipFactory;
    var messageFactory;

    function pluginLoaded() {
        try {
            var mintChipApi = document.getElementById("mintChipApiPlugin");

            mintChipFactory = mintChipApi.mintChipFactory;
            messageFactory = mintChipApi.messageFactory;
        }
        catch (err) {
            //  Handle the error ... 
        }
    } 

The MintChip plugin object also exposes two more properties:

  • currencyCode
  • logType

These provide enumerated values for the CurrencyCode and the LogType respectively.