https://github.com/arez/arez-promise
Arez component that wraps a Promise and makes it observable
https://github.com/arez/arez-promise
arez arez-promise gwt java
Last synced: 6 months ago
JSON representation
Arez component that wraps a Promise and makes it observable
- Host: GitHub
- URL: https://github.com/arez/arez-promise
- Owner: arez
- License: apache-2.0
- Archived: true
- Created: 2018-04-04T01:08:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-25T23:56:46.000Z (almost 5 years ago)
- Last Synced: 2024-04-15T04:23:49.801Z (about 2 years ago)
- Topics: arez, arez-promise, gwt, java
- Language: Ruby
- Homepage:
- Size: 817 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Arez-Promise
[](http://travis-ci.com/arez/arez-promise)
[
](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.realityforge.arez.promise%22)
This library provides an Arez browser component that wraps a Promise and exposes observable
state that tracks the state of the promise.
## Quick Start
The simplest way to use component;
* add the following dependencies into the build system. i.e.
```xml
org.realityforge.arez.promise
arez-promise
0.122
```
* add the snippet `` into the .gwt.xml file.
* Use the `ObservablePromise` component. eg.
```java
import com.google.gwt.core.client.EntryPoint;
import elemental2.dom.DomGlobal;
import elemental2.dom.Response;
import elemental2.promise.Promise;
import arez.Arez;
import arez.promise.ObservablePromise;
public class Example
implements EntryPoint
{
public void onModuleLoad()
{
final Promise promise = DomGlobal.fetch( "https://example.com/" );
final ObservablePromise observablePromise = ObservablePromise.create( promise );
Arez.context().autorun( () -> {
final String message = "Promise Status: " + observablePromise.getState();
DomGlobal.console.log( message );
} );
}
}
```
# More Information
For more information about component, please see the [Website](https://arez.github.io/promise). For the
source code and project support please visit the [GitHub project](https://github.com/arez/arez-promise).
# Contributing
The component was released as open source so others could benefit from the project. We are thankful for any
contributions from the community. A [Code of Conduct](CODE_OF_CONDUCT.md) has been put in place and
a [Contributing](CONTRIBUTING.md) document is under development.
# License
The component is licensed under [Apache License, Version 2.0](LICENSE).