# @types/intercomjs

> TypeScript definitions for intercomjs

Latest version **0.0.33** (published 2024-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/intercomjs
pnpm add @types/intercomjs
yarn add @types/intercomjs
bun add @types/intercomjs
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.33 |
| Published | 2024-01-30 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51441 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/intercomjs
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/intercomjs
- npm.io page: https://npm.io/package/@types/intercomjs

## Recent versions

- 0.0.33 (latest) — 2024-01-30
- 0.0.32 (ts4.5) — 2023-11-07
- 0.0.29 (ts2.0) — 2017-08-21
- 0.0.31 — 2023-10-18
- 0.0.30 — 2023-09-26
- 0.0.28 — 2016-09-19
- 0.0.27 — 2016-07-14
- 0.0.26-alpha — 2016-07-08
- 0.0.25-alpha — 2016-07-04
- 0.0.24-alpha — 2016-07-02
- 0.0.23-alpha — 2016-07-01
- 0.0.22-alpha — 2016-07-01
- 0.0.21-alpha — 2016-05-25
- 0.0.20-alpha — 2016-05-20
- 0.0.15-alpha — 2016-05-19
- … 1 more at https://npm.io/package/@types/intercomjs/versions

## README

# Installation
> `npm install --save @types/intercomjs`

# Summary
This package contains type definitions for intercomjs (https://github.com/diy/intercom.js).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/intercomjs.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/intercomjs/index.d.ts)
````ts
declare namespace intercom {
    interface Intercom {
        /**
         * Broadcasts a message to all open windows (including the current window).
         * @param name The string event name
         * @param message The event data/message
         */
        emit(name: string, message?: any): void;
        /**
         * Sets up a listener to be invoked when a message with the given name is received.
         * @param name The string event name to listen for.
         * @param fn The listener method to invoke.
         */
        on(name: string, fn: Function): void;
        /**
         * Remove a registered event listener
         * @param name The string event listener name.
         * @param fn The listener method to remove.
         */
        off(name: string, fn: Function): void;
        /**
         * Given a unique key to represent the function, fn will be invoked in only one window. The ttl argument represents the number of seconds before the function can be called again.
         * @param key The unique function identifier key
         * @param fn The function to be called once
         * @param ttl The amount of time in seconds to wait before allowing the function to be invoked again.
         */
        once(key: string, fn: Function, ttl?: number): void;
        /**
         * Bind to a socket.io socket and forward all received messages to all windows and/or back to the socket.
         * @param socket A socket.io socket to bind to.
         * @param options Object with "send" and "receive" keys having values of Boolean or Boolean-producing function to determine whether message(s) should be forwarded to/from the socket.
         */
        bind(socket: any, options?: intercom.SocketBindingOptions): void;
    }
    interface SocketBindingOptions {
        send?: any; /* boolean | (name: string, message: any)=>any */
        receive?: any; /* boolean | (name: string, message: any)=>any */
    }
}

interface IntercomStatic {
    /**
     * Returns an instance of Intercom. If one doesn't exist, it will be instantiated.
     * @return an instance of Intercom.
     */
    getInstance(): intercom.Intercom;
    /**
     * Removes all data associated with intercom from localStorage.
     */
    destroy(): void;
}

declare var Intercom: IntercomStatic;

````

### Additional Details
 * Last updated: Tue, 30 Jan 2024 21:35:45 GMT
 * Dependencies: none

# Credits
These definitions were written by [spencerwi](https://github.com/spencerwi).

---
_Source: https://npm.io/package/@types/intercomjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
