---
name: "up.layer.emit"
area: "API"
kind: "JavaScript function"
parent: "up.layer module"
url: "https://unpoly.com/api/up.layer.emit"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.layer module](https://unpoly.com/api/up.layer.md)</nav>

# up.layer.emit(eventType, [props])

[Emits](https://unpoly.com/api/up.emit.md) an event on the [current layer](https://unpoly.com/api/up.layer.current.md)'s [element](https://unpoly.com/api/up.layer.element.md).

This is a shortcut for `up.layer.current.emit()`. See [`up.Layer#emit()`](https://unpoly.com/api/up.Layer.prototype.emit.md) for more documentation.

---

## Parameters {#parameters}

### eventType {#eventType}

(required)

The event type, e.g. `my:event`.

Type: string

### [props={}] {#props}

(optional)

A list of properties to become part of the event object that will be passed to listeners.

Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects)

### [props.log] (Experimental) {#props.log}

(optional)

A message to print to the [log](https://unpoly.com/api/up.log.md) when the event is emitted.

Pass `false` to not log this event emission.

Type: string | [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)

---

## Return value {#return-value}

The emitted event object.

Type: [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event)

