Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Type definitions for react-gateway 2.8
// Project: https://github.com/cloudflare/react-gateway
// Definitions by: Jason Unger <https://github.com/jsonunger>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import Gateway = require('./Gateway');
import { GatewayProps } from './Gateway';
import GatewayDest = require('./GatewayDest');
import { GatewayDestProps } from './GatewayDest';
import GatewayProvider = require('./GatewayProvider');
import GatewayRegistry = require('./GatewayRegistry');

export {
Gateway,
GatewayProps,
GatewayDest,
GatewayDestProps,
GatewayProvider,
GatewayRegistry
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "3.1.0",
"description": "Render React DOM into a new context",
"main": "lib/index.js",
"types": "index.d.ts",
"scripts": {
"build": "babel src -d lib",
"example": "browserify example/browser.js -o example/bundle.js -t babelify --debug && babel-node example/server.js",
Expand Down
9 changes: 9 additions & 0 deletions src/Gateway.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';

declare namespace Gateway {
interface GatewayProps {
into: string;
}
}
declare class Gateway extends React.Component<Gateway.GatewayProps> { }
export = Gateway;
11 changes: 11 additions & 0 deletions src/GatewayDest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as React from 'react';

declare namespace GatewayDest {
interface GatewayDestProps {
name: string;
tagName?: string | undefined;
component?: string | React.ComponentType | undefined;
}
}
declare class GatewayDest extends React.Component<GatewayDest.GatewayDestProps> { }
export = GatewayDest;
4 changes: 4 additions & 0 deletions src/GatewayProvider.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as React from 'react';

declare class GatewayProvider extends React.Component { }
export = GatewayProvider;
20 changes: 20 additions & 0 deletions src/GatewayRegistry.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
declare class GatewayRegistry {
_containers: { [name: string]: React.Component | null | undefined };
_children: { [name: string]: { [gatewayId: string]: React.ReactNode } | undefined };
_currentId: number;

_renderContainer(name: string): void;

addContainer(name: string, container: React.Component): void;

removeContainer(name: string): void;

addChild(name: string, gatewayId: string, child: React.ReactNode): void;

clearChild(name: string, gatewayId: string): void;

register(name: string, child: React.ReactNode): string;

unregister(name: string, gatewayId: string): void;
}
export = GatewayRegistry;