LogoLogo
  • iPaper Technical Documentation
  • Display Analytics
    • Google Analytics
  • Display JavaScript API
    • Quick Start
    • Commands
    • Events
  • Flipbook Analytics
    • Adobe Analytics events
    • Google Analytics / GTM events
  • Flipbook Backend API
    • Overview
    • Return Codes
    • Ecommerce
      • GetFlipbookOrdersByType
      • GetLicenseOrdersByType
    • Image
      • GetImageWith2PxDropShadow
    • Link
      • GetLinks
    • Media
      • CreateDirectory
      • DeleteDirectory
      • DeleteFile
      • GetTree
      • UploadFile
    • Paper
      • ChangePaperUrl
      • ClearPublicationPeriod
      • CreateCategory
      • CreatePaper
      • CreatePreviewToken
      • DeletePaper
      • GetAllPapers
      • GetPaperIDFromUrl
      • GetPaperStructure
      • GetPaperUrlFromID
      • GetSetting
      • GetSettingDescriptions
      • MovePaper
      • SetPublicationPeriod
      • SetSetting
    • Ripper
      • GetProcessingPapers
      • GetProcessingStatus
      • ProcessPDF
      • ReprocessPaper
    • Search
      • SearchPapersByContent
      • SearchPapersByCustomFields
      • SearchPapersWithHiearchyByContent
      • SearchPapersWithHiearchyByName
    • Statistics
      • GetNumberOfPageviewsPerDay
      • GetNumberOfVisitors
      • GetNumberOfVisitorsPerDay
  • Flipbook Enrichment
    • Popup Content
    • Popup Frame
  • Flipbook Integration
    • Custom Domain
    • Custom Mail
    • Embedding flipbooks inside iOS and Android App
    • Form Integration
    • Iframing Flipbooks
    • iPaper Embed Script (Pop-ups)
    • Embeds (Minipapers)
    • Query String Parameters
    • Remote Authentication
    • Shop Export
  • Flipbook JavaScript API
    • Getting Started
    • Commands & Events
      • Basket
      • Consent
        • Example Implementations
          • UserCentrics
          • OneTrust
          • CookieInformation
          • Cookiebot
      • Paging
      • Publication
      • Search
      • Table of Contents
      • Sharing
    • Advanced Usage
    • Migration guide
    • Legacy Javascript API (v2)
      • Quick Start
      • Commands
      • Events
      • Consent Management
      • Advanced Usage
  • Technical Information
    • Cookie Information
    • Common security questions
    • Open Source
Powered by GitBook
On this page
  1. Flipbook JavaScript API

Commands & Events

PreviousGetting StartedNextBasket

Last updated 1 year ago

An introduction to commands & events

A command is an action/instruction sent to the Flipbook. These are used to trigger functionality inside the flipbook.

An event is when certain things happen inside a flipbook. These can be subscribed to in order to execute code when they occur. The code that should be executed is passed as a callback function when subscribing. You can set up multiple subscriptions to the same event. In addition, when you set up a subscription you will get an unsubscribe function returned which can be used to delete/cancel the subscription at any time (Note: You will need to await the subscription setup for the unsubscribe function to be accessible). For example:

var mySubscription = await instance.basket.onToggled(() => {
    console.log('The basket was toggled');
});

mySubscription.unsubscribe();

The JS API comes with an extensive list of commands and events, which are split into the categories below:

In addition to these commands and events, there is also a updateConfig command that can be used to update/set certain config settings of the API instance. The command accepts a single argument, consisting of the properties below:

Property
Type
Description

preventAction

Object

Used to prevent default Flipbook behaviour when certain events are triggered

For the preventAction object inside, this accepts one or multiple of the following properties:

Property
Type
Description

basketClick

boolean

When set to true, this will prevent the native basket from opening

itemAdd

boolean

When set to true, this will prevent all shop items being added to the native basket

Below is an example use which will prevent the native basket from opening:

instance.updateConfig({
    preventAction: {
        basketClick: true,
        itemAdd: true
    }
});
Basket
Consent
Paging
Publication
Search
Table of Contents
Sharing