Basket
Commands
open
open
Opens the basket.
close
close
Closes the basket.
getState
getState
Gets the current state of the basket.
The command will return an object with the following properties:
isOpen
boolean
Is the basket currently open
addProduct
addProduct
Adds a product to the basket. The command accepts a single argument, consisting of the properties below:
title
string
Product title
description
string
Product description
productId
string
Product Id
price
number
Product price
originPage
number
Page where the product is located on
quantity
number
Quanity of product to add
Below is an example use:
Events
onOpened
onOpened
This subscription will trigger every time the basket is opened.
onClosed
onClosed
This subscription will trigger every time the basket is closed.
onToggled
onToggled
This subscription will trigger every time the basket is toggled between open and closed state.
onProductAdd
onProductAdd
This subscription will trigger whenever a product is added to the basket.
Note:
Products added through the addProduct
API command will not trigger this subscription.
The callback contains a value/result of the product that was added, containing the following properties:
title
string
Product title
description
string
Product description
productId
string
Product ID
price
number
Product price
pageIndex
number
Page index where the product is located* (see note)
originPage
number
Page where the product is located on
quantity
number
Quanity of product added
packageSize
number
Number of items per package
Note:
Please note that pageIndex
starts at 0
. So the 1st page of your flipbook will have a pageIndex
of 0
, page 2 a pageIndex
of 1
and so on. To get the actual pagenumber you should use originPage
instead.
Last updated