For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

.rescan()

Re-scan the page for Spiffy embeds and mount any that aren't mounted yet. Returns the number mounted.

You rarely need this. <spiffy-element> and the other embed tags mount themselves whenever they're added to the page, including elements your app inserts after load in a single-page app. .rescan() is only for compatibility-mode containers (plain <div>s used in place of the custom tags), which the browser can't announce on their own.

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)

.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

Last updated