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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef CustomEvent_h__
8 #define CustomEvent_h__
10 #include "mozilla/dom/Event.h"
15 struct CustomEventInit
;
17 class CustomEvent final
: public Event
{
19 virtual ~CustomEvent();
21 JS::Heap
<JS::Value
> mDetail
;
24 explicit CustomEvent(mozilla::dom::EventTarget
* aOwner
,
25 nsPresContext
* aPresContext
= nullptr,
26 mozilla::WidgetEvent
* aEvent
= nullptr);
28 NS_DECL_ISUPPORTS_INHERITED
29 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(CustomEvent
, Event
)
31 static already_AddRefed
<CustomEvent
> Constructor(
32 const GlobalObject
& aGlobal
, const nsAString
& aType
,
33 const CustomEventInit
& aParam
, ErrorResult
& aRv
);
35 virtual JSObject
* WrapObjectInternal(
36 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
38 CustomEvent
* AsCustomEvent() override
{ return this; }
40 void GetDetail(JSContext
* aCx
, JS::MutableHandle
<JS::Value
> aRetval
);
42 void InitCustomEvent(JSContext
* aCx
, const nsAString
& aType
, bool aCanBubble
,
43 bool aCancelable
, JS::Handle
<JS::Value
> aDetail
);
47 } // namespace mozilla
49 already_AddRefed
<mozilla::dom::CustomEvent
> NS_NewDOMCustomEvent(
50 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
51 mozilla::WidgetEvent
* aEvent
);
53 #endif // CustomEvent_h__