Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_PromiseNativeHandler_h
8 : #define mozilla_dom_PromiseNativeHandler_h
9 :
10 : #include "nsISupports.h"
11 : #include "js/TypeDecls.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : /*
17 : * PromiseNativeHandler allows C++ to react to a Promise being rejected/resolved.
18 : * A PromiseNativeHandler can be appended to a Promise using
19 : * Promise::AppendNativeHandler().
20 : */
21 0 : class PromiseNativeHandler : public nsISupports
22 : {
23 : protected:
24 0 : virtual ~PromiseNativeHandler()
25 0 : { }
26 :
27 : public:
28 : virtual void
29 : ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) = 0;
30 :
31 : virtual void
32 : RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) = 0;
33 : };
34 :
35 : } // namespace dom
36 : } // namespace mozilla
37 :
38 : #endif // mozilla_dom_PromiseNativeHandler_h
|