    import NamedEventHandler from 'yjs/src/Util/NamedEventHandler.js'

public class | source

# NamedEventHandler

#### Direct Subclass:

Y

Handles named events.

## Constructor Summary

Public Constructor
public | constructor () |

## Method Summary

Public Methods
public | destroy () |
public | emit (name: String, args: Array) Emit a named event. |
public | off (name: *, f: *) Remove an event listener that was registered with either EventHandler#on or EventHandler#once. |
public | on (name: String, f: Function) Adds a named event listener. |
public | once (name: String, f: Function) Adds a named event listener. |
public | when (name: *): * Returns a Promise that is resolved when the event name is called. |

## Public Constructors

### public constructor() source

## Public Methods

### public destroy() source

### public emit(name: String, args: Array) source

Emit a named event. All registered event listeners that listen to the specified name will receive the event.

#### Params:

Name | Type | Attribute | Description
name | String |  | The event name.
args | Array |  | The arguments that are applied to the event listener.

### public off(name: *, f: *) source

Remove an event listener that was registered with either EventHandler#on or EventHandler#once.

#### Params:

Name | Type | Attribute | Description
name | * |  |
f | * |  |

### public on(name: String, f: Function) source

Adds a named event listener.

#### Params:

Name | Type | Attribute | Description
name | String |  | The event name to listen to.
f | Function |  | The function that is executed when the event is fired.

### public once(name: String, f: Function) source

Adds a named event listener. The listener is removed after it has been called once.

#### Params:

Name | Type | Attribute | Description
name | String |  | The event name to listen to.
f | Function |  | The function that is executed when the event is fired.

### public when(name: *): * source

Returns a Promise that is resolved when the event name is called. The Promise is immediately resolved when the event name was called in the past.

#### Params:

Name | Type | Attribute | Description
name | * |  |

#### Return:

*