1.0.1-alpha01 • Published 4 years ago
@ts-livedata/core v1.0.1-alpha01
TS LiveData Library
About
Observer pattern based library for TypeScript, similar to Android's LiveData.
For information on the Observer pattern please visit Wikipedia.
Installation
npm install @ts-livedata/core
yarn add @ts-livedata/core
Usage
import {MutableLiveData, Observer} from "@ts-livedata/core"
const liveData = new MutableLiveData<String | null>()
const observer: Observer<String | null> = (value => {
if (value) {
console.log(`your value: ${value}`)
} else {
console.log(`null value`)
}
})
// Can observer before or after posting a value
liveData.observe(observer)
liveData.postValue("TypeScript LiveData")
// When you're ready to stop listening for changes
liveData.removeObserver(observer)
// Or you can remove all observers via
liveData.removeAllObservers()
Questions
Feel free to drop a Github issue with any questions you may have.
License
This project is licensed under the terms of the Apache 2.0 license.
1.0.1-alpha01
4 years ago
1.0.0-alpha02
4 years ago
1.0.0-alpha01
4 years ago
0.0.0-alpha07
4 years ago
0.0.0-alpha06
4 years ago
0.0.0-alpha05
4 years ago
0.0.0-alpha04
4 years ago
0.0.0-alpha01
4 years ago
0.0.0-alpha02
4 years ago
0.0.0-alpha03
4 years ago
0.1.9
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago