# @types/post-robot

> TypeScript definitions for post-robot

Latest version **10.0.6** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/post-robot
pnpm add @types/post-robot
yarn add @types/post-robot
bun add @types/post-robot
```

## 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.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 10.0.6 |
| Published | 2023-11-07 |
| First published | 2020-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51449 |
| Maintainers | types |

## Links

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

## Recent versions

- 10.0.6 (latest) — 2023-11-07
- 10.0.3 (ts3.6) — 2021-07-08
- 10.0.2 (ts3.5) — 2021-05-26
- 10.0.1 (ts3.2) — 2020-11-17
- 10.0.5 — 2023-10-18
- 10.0.4 — 2023-09-24
- 10.0.0 — 2020-10-15

## README

# Installation
> `npm install --save @types/post-robot`

# Summary
This package contains type definitions for post-robot (https://github.com/krakenjs/post-robot).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/post-robot.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/post-robot/index.d.ts)
````ts
// to shut off automatic exports
export {};
// Warning: This is not actually a Promise, but the interface is the same.
type ZalgoPromise<T> = Promise<T>;
// For the purposes of using the library on it's own Window is CrossDomain enough
type CrossDomainWindowType = Window | null;
type DomainMatcher = string | RegExp | string[];
type HandlerType = (event: {
    source: CrossDomainWindowType;
    origin: string;
    data: any;
}) => ZalgoPromise<any>;
type ErrorHandlerType = (err: any) => void;

interface ServerOptionsType {
    handler?: HandlerType | undefined;
    errorHandler?: ErrorHandlerType | undefined;
    window?: CrossDomainWindowType | undefined;
    name?: string | undefined;
    domain?: DomainMatcher | undefined;
    once?: boolean | undefined;
    errorOnClose?: boolean | undefined;
}

interface CancelableType {
    cancel: () => void;
}

// based on https://github.com/post-robot/src/public/on.js
export function on(name: string, options: ServerOptionsType | HandlerType, handler?: HandlerType): CancelableType;

export function once(
    name: string,
    options?: ServerOptionsType | HandlerType,
    handler?: HandlerType,
): ZalgoPromise<{ source: any; origin: string; data: object }>;

interface RegularRequestOptionsType {
    domain?: DomainMatcher | undefined;
    fireAndForget?: false | undefined;
    timeout?: number | undefined;
}

interface ResponseMessageEvent {
    source: CrossDomainWindowType;
    origin: string;
    data: object;
}

interface FireAndForgetRequestOptionsType {
    domain?: DomainMatcher | undefined;
    fireAndForget?: true | undefined;
    timeout?: number | undefined;
}

// based on https://github.com/post-robot/src/public/send.js
export function send(
    win: CrossDomainWindowType,
    name: string,
    data?: object,
    options?: FireAndForgetRequestOptionsType & RegularRequestOptionsType,
): ZalgoPromise<ResponseMessageEvent>;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: none

# Credits
These definitions were written by [NinoScript](https://github.com/NinoScript), and [Cijin](https://github.com/Cijin).

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