-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(infra): livedata #5562
feat(infra): livedata #5562
Conversation
Your org has enabled the Graphite merge queue for merging into canaryYou must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. You can enable merging using labels in your Graphite merge queue settings. |
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## canary #5562 +/- ##
=======================================
Coverage 64.59% 64.59%
=======================================
Files 296 298 +2
Lines 18338 18423 +85
Branches 1478 1489 +11
=======================================
+ Hits 11845 11901 +56
- Misses 6324 6352 +28
- Partials 169 170 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
d58d0be
to
a599eeb
Compare
d016a0b
to
2f9685b
Compare
Who is this @example? |
9fdb9ff
to
c07ae9b
Compare
61df54e
to
fdb1fd1
Compare
Merge activity
|
LiveData is a reactive data type. ## basic usage @example ```ts const livedata = new LiveData(0); // create livedata with initial value livedata.next(1); // update value console.log(livedata.value); // get current value livedata.subscribe(v => { // subscribe to value changes console.log(v); // 1 }); ``` ## observable LiveData is a rxjs observable, you can use rxjs operators. @example ```ts new LiveData(0).pipe( map(v => v + 1), filter(v => v > 1), ... ) ``` NOTICE: different from normal observable, LiveData will always emit the latest value when you subscribe to it. ## from observable LiveData can be created from observable or from other livedata. @example ```ts const A = LiveData.from( of(1, 2, 3, 4), // from observable 0 // initial value ); const B = LiveData.from( A.pipe(map(v => 'from a ' + v)), // from other livedata '' // initial value ); ``` NOTICE: LiveData.from will not complete when the observable completes, you can use `spreadComplete` option to change this behavior. ## Why is it called LiveData This API is very similar to LiveData in Android, as both are based on Observable, so I named it LiveData.
LiveData is a reactive data type. ## basic usage @example ```ts const livedata = new LiveData(0); // create livedata with initial value livedata.next(1); // update value console.log(livedata.value); // get current value livedata.subscribe(v => { // subscribe to value changes console.log(v); // 1 }); ``` ## observable LiveData is a rxjs observable, you can use rxjs operators. @example ```ts new LiveData(0).pipe( map(v => v + 1), filter(v => v > 1), ... ) ``` NOTICE: different from normal observable, LiveData will always emit the latest value when you subscribe to it. ## from observable LiveData can be created from observable or from other livedata. @example ```ts const A = LiveData.from( of(1, 2, 3, 4), // from observable 0 // initial value ); const B = LiveData.from( A.pipe(map(v => 'from a ' + v)), // from other livedata '' // initial value ); ``` NOTICE: LiveData.from will not complete when the observable completes, you can use `spreadComplete` option to change this behavior. ## Why is it called LiveData This API is very similar to LiveData in Android, as both are based on Observable, so I named it LiveData.
LiveData is a reactive data type.
basic usage
@example
observable
LiveData is a rxjs observable, you can use rxjs operators.
@example
NOTICE: different from normal observable, LiveData will always emit the latest value when you subscribe to it.
from observable
LiveData can be created from observable or from other livedata.
@example
NOTICE: LiveData.from will not complete when the observable completes, you can use
spreadComplete
option to changethis behavior.
Why is it called LiveData
This API is very similar to LiveData in Android, as both are based on Observable, so I named it LiveData.