Ir al contenido

on()

Esta página aún no está disponible en tu idioma.

Methodcom.tryyoursize:tryyoursize-android

Window events: Ready, Open, Close, Size, LoadError.

public fun on(handler: (Event) -> Unit): TysSubscription
handler(Event) -> UnitObligatorio

Called with each window event.

Ready(val product: String)Opcional

The window is shown and connected.

Open(val product: String)Opcional
Close(val product: String)Opcional
Size(val selection: SizeSelection)Opcional

The shopper chose a size: preselect it.

LoadError(val error: TryYourSizeException)Opcional

Our window could not be reached, or this app is not registered for the key.

A subscription; cancel() stops the events.

val sub = tys.on { event ->
when (event) {
is TryYourSize.Event.Size -> selected = event.selection.size
is TryYourSize.Event.LoadError -> Log.w("tys", event.error.code.wire)
else -> Unit
}
}

¿Te ha resultado útil esta página?