# Signal

```ts
interface Signal<T, TClose> extends Stream<T, TClose>
```

Convert plain JavaScript function calls into a [Stream](https://frontside.com/effection/api/v3/Stream.md) that can
be consumed within an operation. If no operation is subscribed to a signal's
stream, then sending messages to it is a no-op.

Signals are particularly suited to be installed as event listeners.

### Examples
#### Example 1
```typescript
import { createSignal, each } from "effection";

export function* logClicks(function*(button) {
  let clicks = createSignal<MouseEvent>();

  button.addEventListener("click", clicks.send);

  try {
    for (let click of yield* each(clicks)) {
      console.log(`click:`, click);
      yield* each.next();
    }
  } finally {
    button.removeEventListener("click", clicks.send);
  }
})
````

---


### Type Parameters
T
type of each event sent by this signal


TClose
type of the final event sent by this signal


### Methods
<dl>
<dt class="border-dotted [&:not(:first-child)]:border-t-2 [&:not(:first-child)]:pt-3 [&:not(:first-child)]:mt-2"><h4 id="send" class="inline scroll-mt-[100px]">send</h4>(**value**: T): void</dt>
<dd class="flex flex-col [&>pre]:mb-3 [&>p:not(:first-child)]:mt-0" >
Send a value to all the consumers of this signal.

</dd>
<dt class="border-dotted [&:not(:first-child)]:border-t-2 [&:not(:first-child)]:pt-3 [&:not(:first-child)]:mt-2"><h4 id="close" class="inline scroll-mt-[100px]">close</h4>(**value**: TClose): void</dt>
<dd class="flex flex-col [&>pre]:mb-3 [&>p:not(:first-child)]:mt-0" >
Send the final value of this signal to all its consumers.
</dd>
</dl>

[View code](https://github.com/thefrontside/effection/tree/effection-v3.6.1/lib/signal.ts#L38)
