本文整理汇总了C++中EventTarget::AddEventListener方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::AddEventListener方法的具体用法?C++ EventTarget::AddEventListener怎么用?C++ EventTarget::AddEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventTarget
的用法示例。
在下文中一共展示了EventTarget::AddEventListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
nsFormFillController::AddWindowListeners(nsPIDOMWindow *aWindow)
{
if (!aWindow)
return;
EventTarget* target = aWindow->GetChromeEventHandler();
if (!target)
return;
target->AddEventListener(NS_LITERAL_STRING("focus"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("blur"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("pagehide"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("mousedown"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("input"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("keypress"), this, true, false);
target->AddEventListener(NS_LITERAL_STRING("compositionstart"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("compositionend"), this,
true, false);
target->AddEventListener(NS_LITERAL_STRING("contextmenu"), this,
true, false);
// Note that any additional listeners added should ensure that they ignore
// untrusted events, which might be sent by content that's up to no good.
}