DefinitelyTyped/types/react-frame-component/index.d.ts
a learning git 306afbe5c0 Add FrameContext types (#38996)
For people who wants to use `hooks`  like
```javascript
import React, { useContext } from 'react'
const { window: frameWindow } = useContext(FrameContext)
```
2019-10-09 12:08:44 -07:00

30 lines
949 B
TypeScript

// Type definitions for react-frame-component 4.1
// Project: https://github.com/ryanseddon/react-frame-component
// Definitions by: Alex Bukurov <https://github.com/abukurov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export interface FrameComponentProps extends React.IframeHTMLAttributes<HTMLIFrameElement> {
head?: React.ReactNode;
mountTarget?: string;
initialContent?: string;
contentDidMount?: () => void;
contentDidUpdate?: () => void;
children: React.ReactNode;
}
export default class FrameComponent extends React.Component<FrameComponentProps> {}
export interface FrameContextProps {
document?: any;
window?: any;
}
export const FrameContext: React.Context<FrameContextProps>;
export const FrameContextProvider: React.Provider<FrameContextProps>;
export const FrameContextConsumer: React.Consumer<FrameContextProps>;