@asoft-ltd/live-core
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

Live

badge badge badge badge badge badge

Introduction

Heavily inspired by LiveData, We need a kotlin multiplatform way to set data in the common main ViewModels and observe it in android, web, desktop, ios and any place where we can implement declarative UI

Problem Statement

While it is true that kotlin can has a SateFlow in the coroutines library, using that from non kotlin code (i.e. Swift and JavaScript) needs a lot of wrappers to work

Setup

npm install @asoft-ltd/live-core

Samples

const live = Live<number>(1)
const watcher = liveInt.watch {
    console.log("Watcher 1: $it")
}   // console: "Watcher 1: 1"
live.value = 2 // console: "Watcher 1: 2"
watcher.stop() // or live.stop(watcher)
live.value = 3 // console: 

Note:

this Live<S> should only be used in presentational layers. Its main purpose is to just change state for ui

Readme

Keywords

Package Sidebar

Install

npm i @asoft-ltd/live-core

Weekly Downloads

4

Version

0.0.15

License

MIT

Unpacked Size

12.1 kB

Total Files

10

Last publish

Collaborators

  • andylamax