script_bindings/routed_promise.rs
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use js::context::JSContext;
6use serde::Serialize;
7use serde::de::DeserializeOwned;
8
9use crate::DomTypes;
10use crate::interfaces::PromiseHelpers;
11
12pub trait RoutedPromiseListener<D: DomTypes, R: Serialize + DeserializeOwned + Send> {
13 fn handle_response(
14 &self,
15 cx: &mut JSContext,
16 response: R,
17 promise: &<D::Promise as PromiseHelpers<D>>::StackRoot,
18 );
19}