Methods

.config(configObj)

Modify the global Spiffy.js config before spiffy.load()

.load(account)

Start up and mount Spiffy.js for your account

  • account - String of Spiffy account subdomain

.debug()

Put Spiffy.js into debug mode which logs helpful developer details to the console

.checkout(url, [configObj])

Create or access existing checkout instance object. Returns a checkout object

  • url - String of the URL of the checkout

  • configObj - Optional object of checkout settings

Add/Remove Event Listeners

The .on() and .off() methods can be used globally on the spiffy object for global-only events as well as catch-all event handlers for events specific to major sub-objects such as Checkouts

These methods can also be used directly on a Checkout object to scope event handling to that specific checkout.

.on(event, handler)

Adds a global event listener to all Spiffy objects

  • event - String of event name

  • handler - Function to be ran when event is triggered

    • The handler function will get varying data objects passed in (depending the event being fired)

spiffy.on('ready', function () {
    // do things here when spiffy is ready!
})

.off(event, handler)

Removes global event listeners from Spiffy objects

  • event - String of event name

  • handler - Function to be ran when event is triggered

    • NOTE: The handler function must match the exact function used when adding the event listener

spiffy.off('ready', function () {
    // do things here when spiffy is ready!
})

Last updated