ionic-team / ionic-portals-android

Other
4 stars 3 forks source link

feat: Web Vitals support for FCP, FID, TTFB #28

Closed carlpoole closed 1 year ago

carlpoole commented 1 year ago

Adds Web Vitals support for FCP, FID, and TTFB to Android Portals

Kotlin Usage

portalFragment = PortalFragment(checkoutPortal, (metric, time) -> {
    Log.d("VITALS", "$metric: ${time}ms"
});

Java Usage

portalFragment = new PortalFragment(checkoutPortal, (metric, time) -> {
    Log.d("VITALS", metric.name() + ": " + time+ "ms");
    return null;
});

Jetpack Compose example usage

@Composable
fun loadPortal(portalId: String) {
    AndroidView(factory = {
        PortalView(it, portalId) { metric, time -> Log.d("VITALS", "$metric: ${time}ms") }
    })
}