-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
await for getClusterLeaves #9739
Comments
Duplicate of #3964 |
I am not able to await getClusterleaves. Can someone give an example of how I can wait for the getClusterLeaves? I need to have the leaves before continue running the next code await clusterSource.getClusterLeaves(clusterId, total, 0, function (err, aFeatures) { |
In my case I created a vue method to wrap the callback based function with a Promise:
this could then be used by:
|
Motivation
basically described here:
#8613
I want to run over a bunch of clusters make some calculation over their leaves and then set the data of a source. Having a callback in the middle for all clusters makes the whole procedure hard
Design Alternatives
have an await for getClusterLeaves
Design
getClusterLeaves with Promise a basically because Callbacks should be dead
Mock-Up
source_layer.getClusterLeaves(cluster_id, cluster.properties.point_count, 0).then(leaves => {}).catch(err => {}) ....
leaves = await source_layer.getClusterLeaves(cluster_id, cluster.properties.point_count, 0)
Concepts
Promises, many JS developer know promises by now
The text was updated successfully, but these errors were encountered: