# Class: Event

## Event

#### new Event()

  RichFaces Event API container
  Source:
    - richfaces-event.js, line 35

### Members

#### <static, constant> EVENT_NAMESPACE_SEPARATOR :string

  ##### Type:

  - string
  Source:
    - richfaces-event.js, line 85

#### <static, constant> RICH_NAMESPACE :string

  ##### Type:

  - string
  Source:
    - richfaces-event.js, line 78

### Methods

#### <static> bind(selector, eventType, fn, data) → {function}

  Attach a handler to an event for the elements.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `selector` | string | DOMElement | jQuery |  | jQuery elements selector
  `eventType` | string |  | one or more JavaScript event types, such as "click" or "submit," or custom event names
  `fn` | function |  | event handler
  `data` | Object | <optional> | component or object with additional data It is a context for an event handler

  Source:
    - richfaces-event.js, line 112

  ##### Returns:

  function that binded to the element's event
  Type
    function

#### <static> bindById(id, eventType, fn, data) → {function}

  Attach a handler to an event for the element by element id.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `id` | string |  | DOM element id
  `eventType` | string |  | one or more JavaScript event types, such as "click" or "submit," or custom event names
  `fn` | function |  | event handler
  `data` | Object | <optional> | component or object with additional data It is a context for an event handler

  Source:
    - richfaces-event.js, line 136

  ##### Returns:

  function that binded to the element's event
  Type
    function

#### <static> bindOne(selector, eventType, fn, data) → {function}

  Attach a handler to an event for the elements. The handler will be called only once when event happened.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `selector` | string | DOMElement | jQuery |  | jQuery elements selector
  `eventType` | string |  | one or more JavaScript event types, such as "click" or "submit," or custom event names
  `fn` | function |  | event handler
  `data` | Object | <optional> | component or object with additional data It is a context for an event handler

  Source:
    - richfaces-event.js, line 160

  ##### Returns:

  function that binded to the element's event
  Type
    function

#### <static> bindOneById(id, eventType, fn, data) → {function}

  Attach a handler to an event for the element by element id. The handler will be called only once when event happened.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `id` | string |  | DOM element id
  `eventType` | string |  | one or more JavaScript event types, such as "click" or "submit," or custom event names
  `fn` | function |  | event handler
  `data` | Object | <optional> | component or object with additional data It is a context for an event handler

  Source:
    - richfaces-event.js, line 180

  ##### Returns:

  function that binded to the element's event
  Type
    function

#### <static> callHandler(selector, eventType, data)

  The same as the fire method, but: - does not cause the default behavior of an event to occur - does not bubble up event - call handler only for the first founded element - returns whatever value that was returned by the handler

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `selector` | string | DOMElement | jQuery |  | jQuery elements selector
  `eventType` | string |  | event type
  `data` | Object | <optional> | a object of additional parameters to pass to the event handler

  Source:
    - richfaces-event.js, line 280

  ##### Returns:

  value that was returned by the handler

#### <static> callHandlerById(id, eventType, data)

  The same as the callHandler method, but selects element by id.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `id` | string |  | DOM element id
  `eventType` | string |  | event type
  `data` | Object | <optional> | a object of additional parameters to pass to the event handler

  Source:
    - richfaces-event.js, line 298

  ##### Returns:

  value that was returned by the handler

#### <static> createNamespace(componentName, id, prefix) → {string}

  Create an event namespace for the components.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `componentName` | string | <optional> |  | component name
  `id` | string | <optional> |  | element id
  `prefix` | string | <optional> | RichFaces.Event.RICH_NAMESPACE | namespace prefix

  Source:
    - richfaces-event.js, line 312

  ##### Returns:

  namespace string
  Type
    string

#### <static> fire(selector, eventType, data) → {jQuery}

  Execute all handlers and behaviors attached to the matched elements for the given event type.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `selector` | string | DOMElement | jQuery |  | jQuery elements selector
  `eventType` | string |  | event type
  `data` | Object | <optional> | a object of additional parameters to pass to the event handler

  Source:
    - richfaces-event.js, line 248

  ##### Returns:

  element wrapped by jQuery
  Type
    jQuery

#### <static> fireById(id, eventType, data) → {jQuery}

  The same as the fire method, but selects element by id.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `id` | string |  | DOM element id
  `eventType` | string |  | event type
  `data` | Object | <optional> | a object of additional parameters to pass to the event handler

  Source:
    - richfaces-event.js, line 264

  ##### Returns:

  element wrapped by jQuery
  Type
    jQuery

#### <static> ready(fn) → {jQuery}

  Attach an event handler to execute when the DOM is fully loaded.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `fn` | function | event handler

  Source:
    - richfaces-event.js, line 94

  ##### Returns:

  document element wrapped by jQuery
  Type
    jQuery

#### <static> unbind(selector, eventType, fn) → {jQuery}

  Remove a previously-attached event handler from the elements.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `selector` | string | DOMElement | jQuery |  | jQuery elements selector
  `eventType` | string | <optional> | one or more JavaScript event types, such as "click" or "submit," or custom event names
  `fn` | function | <optional> | event handler

  Source:
    - richfaces-event.js, line 200

  ##### Returns:

  element wrapped by jQuery
  Type
    jQuery

#### <static> unbindById(id, eventType, fn) → {jQuery}

  Remove a previously-attached event handler from the elements by element id. The handler will be called only once when event happened.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `id` | string |  | DOM element id
  `eventType` | string | <optional> | one or more JavaScript event types, such as "click" or "submit," or custom event names
  `fn` | function | <optional> | event handler

  Source:
    - richfaces-event.js, line 215

  ##### Returns:

  element wrapped by jQuery
  Type
    jQuery