本文整理汇总了C++中EventListenerManager::AddEventListener方法的典型用法代码示例。如果您正苦于以下问题:C++ EventListenerManager::AddEventListener方法的具体用法?C++ EventListenerManager::AddEventListener怎么用?C++ EventListenerManager::AddEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventListenerManager
的用法示例。
在下文中一共展示了EventListenerManager::AddEventListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WantsUntrusted
void
DOMEventTargetHelper::AddEventListener(const nsAString& aType,
EventListener* aListener,
const AddEventListenerOptionsOrBoolean& aOptions,
const Nullable<bool>& aWantsUntrusted,
ErrorResult& aRv)
{
bool wantsUntrusted;
if (aWantsUntrusted.IsNull()) {
nsresult rv = WantsUntrusted(&wantsUntrusted);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
}
} else {
wantsUntrusted = aWantsUntrusted.Value();
}
EventListenerManager* elm = GetOrCreateListenerManager();
if (!elm) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
elm->AddEventListener(aType, aListener, aOptions, wantsUntrusted);
}
示例2: GetOrCreateListenerManager
void
nsWindowRoot::AddEventListener(const nsAString& aType,
EventListener* aListener,
bool aUseCapture,
const Nullable<bool>& aWantsUntrusted,
ErrorResult& aRv)
{
bool wantsUntrusted = !aWantsUntrusted.IsNull() && aWantsUntrusted.Value();
EventListenerManager* elm = GetOrCreateListenerManager();
if (!elm) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
elm->AddEventListener(aType, aListener, aUseCapture, wantsUntrusted);
}
示例3: ComputeWantsUntrusted
nsresult
EventTarget::AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
bool aUseCapture,
const Nullable<bool>& aWantsUntrusted)
{
ErrorResult rv;
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
EventListenerManager* elm = GetOrCreateListenerManager();
NS_ENSURE_STATE(elm);
elm->AddEventListener(aType, aListener, aUseCapture, wantsUntrusted);
return NS_OK;
}