github varabyte/kobweb v0.17.1

latest releases: v0.24.0, v0.23.3, v0.23.2...
2 years ago

This is a small release which adds a new feature to Kobweb Workers and has also migrated its dependencies to target Compose 1.6.1 and Kotlin 1.9.23.

Important

Planning to upgrade? Review instructions in the README.


Changes

Workers

  • Kobweb workers now support transferable objects
    • Transferable objects are a web solution to passing very large objects between an application and its workers
    • You can read more about them in the README
    • ⚠️ Backwards incompatible Unfortunately, this change will cause a compile error for anyone who is already using workers. The fix is easy, however. See the Notes section for more information.

Notes

The WorkerFactory interface has changed and will cause compile errors

In order to support transferable objects, the WorkerFactory interface has changed from using a lambda:

interface WorkerFactory<I, O> {
   fun createStrategy(postOutput: (O) -> Unit): WorkerStrategy<I>
}

to using a new class called OutputDispatcher:

interface WorkerFactory<I, O> {
   fun createStrategy(postOutput: OutputDispatcher<O>): WorkerStrategy<I>
}

Please update any implementations accordingly. Once the signature has been updated, your code should compile again as before.

For example, here is the diff in the empty template:

internal class EchoWorkerFactory : WorkerFactory<String, String> {
-  override fun createStrategy(postOutput: (String) -> Unit) = WorkerStrategy<String> { input ->
+  override fun createStrategy(postOutput: OutputDispatcher<String>) = WorkerStrategy<String> { input ->
      postOutput(input) // Add real worker logic here
   }
}

Deprecated code

We occasionally audit the codebase for deprecated code older than 6 months. In this case, we removed a lot. Hopefully, this won't affect you, if you already moved away from such code.

You can review this commit to see if a compile error you're getting was due to such a method


Full Changelog: v0.17.0...v0.17.1

Don't miss a new kobweb release

NewReleases is sending notifications on new releases.