//Create an Observable of a list
val observable = Observable("Hello")
//Create an Observer for this data
val observer = Observer { newValue ->
println(newValue)
}
//Subscribe to the Observable
observable.subscribe(observer)
observable.value = "Hello World!"
//The observer code will be executed and Hello World! will be printed
//Don't forget to unsubscribe
observable.unsubscribe(observer)
- Installation
- Usage
- Built With
- Contributing
- Versioning
- Authors
- License
Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.marcbenedi:Observer:1.0'
}
See more instructions on Jitpack
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
For the versions available, see the tags on this repository. It is always recommended to use the latest version.
- Marc Benedí - Author and developer
See also the list of contributors who participated in this project.
This project is licensed under the Apache license 2.0 - see the LICENSE.md file for details
Copyright 2018 Marc Benedí
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.