0.1.6•Updated a month ago
declare namespace Audience {
type Events<CustomFields extends Audience.CustomFieldMap> = {
/**
* Event for adding an entry to the ledger.
*
* @param entry_values All values passed to the creation of the new entry
*/
'audience_created': [Audience.Audience<any>]
/**
* Event for adding an entry to the ledger.
*
* @param entry_values All values passed to the creation of the new entry
*/
'item_created': [entry: Audience.Item.Unentered<CustomFields>]
/**
* Event for adding an entry to the ledger.
*
* @param reason Why this entry could not be created
*/
'entry_creation_failed': [reason: string, entry: Ledger.Entry.Unentered]
/**
* Runs before a consumption is added to the ledger. Cancelable.
*
* @param params The information that will be used to create the consumption entry
* @param fail Call this with `true` to cancel the consumption event.
*/
'before-consumption': [params: Ledger.Consumption.Entry, fail: Events.FailMethod, after_consumption: (cb: () => void | Promise<void>) => void]
/**
* Runs after a consumption has been added to the ledger.
*
* @param consumption_data The ID of the new entry, and data about the altered entries
* @param params The information that was used to create the consumption entry
*/
'consumption': [consumption_data: Ledger.Consumption.Function.Response, params: Ledger.Consumption.Entry]
}
namespace Events {
type FailMethod = (reason?: string) => void
}
}