adopted-ember-addons / adopted-ember-addons/ember-metrics

[Feature Request] Show Ember Metrics allow promise from Adapters (or callback)?

Ouverte
#170 0 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
367
Forks
158
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

In a situation where a website wants to perform an action once the metrics call is complete, it would be nice to be able to return a promise from the custom adapter (or pass in a callback to be called upon completion). Right now, the `invoke` method sends off the requests to the adapters, but there is no mechanism to allow something returned from the adapter to be returned back to the app. So even if the adapter is written to return a promise, it cannot.

It might be simpler to allow a callback to be passed along to the adapter, but I think a promise would be the preferable option.

As for a use case, I'm in a situation where we'd like to push an event when the user logs out, but would need to delay a page redirect to login until the call finishes, or the browser just aborts the request (if the request is ever even fired, depending on implementation in the adapter). But I imagine there are plenty of other use cases for knowing when the metrics call is complete.

If there is interest, I may be able to take a look at what it would take to implement.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.