SpiffyJS
  • SpiffyJS
    • Overview
    • Config
    • Elements
    • Methods
    • Events
    • Checkouts
      • Settings
      • Methods
      • Events
    • Affiliates
  • JavaScript API (beta)
    • Overview
    • Examples
  • Examples
    • Full Page Loader
    • Dynamically Apply Discounts
  • REST API
  • Back to Spiffy
Powered by GitBook
On this page
  • .config(configObj)
  • .load(account)
  • .debug()
  • .checkout(url, [configObj])
  • Add/Remove Event Listeners
  • .on(event, handler)
  • .off(event, handler)

Was this helpful?

  1. SpiffyJS

Methods

PreviousElementsNextEvents

Last updated 4 years ago

Was this helpful?

.config(configObj)

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

  • configObj - Object of

.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

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!
})

config
config properties
checkout settings