Events
NativebrikEvent
NativebrikEvent
は、NativebrikClient.dispatch
が呼び出された際にディスパッチされるイベントです。このイベントがディスパッチされると、NativebrikClient.overlay
がイベントに一致したポップアップ実験を表示します。
public struct NativebrikEvent {
public init(_ name: String)
}
NativebrikEvent
インスタンスを使って、NativebrikClient.dispatch
を呼び出すことで NativebrikEvent
をディスパッチできます:
nativebrikClient.dispatch(event: NativebrikEvent("<TRIGGER_EVENT_NAME>"))
ComponentEvent
ComponentEvent
は、エクスペリメントにユーザーがアクションしたときにディスパッチされるイベントです。
例えば、ユーザーがエクスペリメント内でボタンをタップした際、ComponentEvent
がディスパッチされ、そのプロパティが定義されます。
ComponentEvent
は、NativebrikClient
または NativebrikExperiment.embedding
を初期化する際に onEvent
引数を使ってリッスンできます。
定義
public struct ComponentEvent {
public let name: String?
public let destinationPageId: String?
public let deepLink: String?
public let payload: [EventProperty]?
}
public struct EventProperty {
public let name: String
public let value: String
public let type: EventPropertyType
}
public enum EventPropertyType {
case INTEGER
case STRING
case TIMESTAMPZ
case UNKNOWN
}
Last updated