All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.KlipManager.kt Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
package dev.petuska.klip.core

import dev.petuska.klip.api.KlipContext
import dev.petuska.klip.core.domain.Klip
import kotlin.reflect.KType

internal expect object KlipManager {
  suspend fun  writeKlip(context: KlipContext, klip: Klip)
  suspend fun  readKlip(context: KlipContext, type: KType): Klip?
}

public suspend fun  KlipContext.syncKlip(actual: Klip): Klip {
  return if (update) {
    actual.also {
      KlipManager.writeKlip(this, it)
    }
  } else {
    KlipManager.readKlip(this, actual.type) ?: actual.also {
      KlipManager.writeKlip(this, it)
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy