FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
void FB::JSAPIImpl::registerEventMethod ( const std::string &  name,
JSObjectPtr event 
)
virtual

Called by the browser to register an event handler method.

Parameters
nameThe name.
eventThe event handler method.

Reimplemented from FB::JSAPI.

Definition at line 249 of file JSAPIImpl.cpp.

Referenced by registerEventMethod().

250 {
251  if (!event)
252  throw invalid_arguments();
253 
254  boost::recursive_mutex::scoped_lock _l(m_eventMutex);
255  std::pair<EventMultiMap::iterator, EventMultiMap::iterator> range = m_eventMap[event->getEventContext()].equal_range(name);
256 
257  for (EventMultiMap::iterator it = range.first; it != range.second; ++it) {
258  if (it->second->getEventId() == event->getEventId()) {
259  return; // Already registered
260  }
261  }
262  m_eventMap[event->getEventContext()].insert(EventPair(name, event));
263 }
Thrown by a JSAPI object when the argument(s) provided to a SetProperty or Invoke call are found to b...
Definition: JSExceptions.h:47