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

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

未关闭
#170 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
367
派生
158
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。