From 042df271122ef29911f0e1ae119df497a92324c0 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 19 Jul 2017 18:25:56 +0900 Subject: [PATCH] ing --- src/ts/@overflow/app/index.tsx | 16 ++++++++-------- src/ts/@overflow/app/views/member/SignIn.tsx | 9 +++++++++ .../commons/context/decorator/inject.ts | 19 +++++++++++++++++++ .../context/{ => decorator}/injectable.ts | 0 src/ts/@overflow/commons/context/inject.ts | 11 ----------- .../commons/websocket/WebSocketRPC.ts | 2 +- 6 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 src/ts/@overflow/commons/context/decorator/inject.ts rename src/ts/@overflow/commons/context/{ => decorator}/injectable.ts (100%) delete mode 100644 src/ts/@overflow/commons/context/inject.ts diff --git a/src/ts/@overflow/app/index.tsx b/src/ts/@overflow/app/index.tsx index 8ea2c4d..1209df4 100644 --- a/src/ts/@overflow/app/index.tsx +++ b/src/ts/@overflow/app/index.tsx @@ -34,14 +34,14 @@ function* app(): any { sagaMiddleware.run(sagas); - // ReactDOM.render( - // - // - // {routes} - // - // , - // appContainer, - // ); + ReactDOM.render( + + + {routes} + + , + appContainer, + ); } sagaMiddleware.run(app); diff --git a/src/ts/@overflow/app/views/member/SignIn.tsx b/src/ts/@overflow/app/views/member/SignIn.tsx index 79f2073..b7e8caa 100644 --- a/src/ts/@overflow/app/views/member/SignIn.tsx +++ b/src/ts/@overflow/app/views/member/SignIn.tsx @@ -1,13 +1,22 @@ import * as React from 'react'; import { RouteComponentProps } from 'react-router'; import SignInContainer from '@overflow/member/react/SignIn'; +import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC'; +import inject from '@overflow/commons/context/decorator/inject'; class Signin extends React.Component, object> { + @inject() + private client: WebSocketRPC; + public render(): JSX.Element { return ( ); } + + private test(@inject() c: WebSocketRPC): void { + console.log(''); + } } diff --git a/src/ts/@overflow/commons/context/decorator/inject.ts b/src/ts/@overflow/commons/context/decorator/inject.ts new file mode 100644 index 0000000..5448f43 --- /dev/null +++ b/src/ts/@overflow/commons/context/decorator/inject.ts @@ -0,0 +1,19 @@ + +import * as METADATA from './constants'; + + +const inject = (type?: TFunction) => { + return (target: Object, propertyKey: string | symbol, parameterIndex?: number): void => { + if (typeof parameterIndex === 'number') { + // tagParameter(target, targetKey, index, metadata); + } else { + let types = Reflect.getMetadata('design:type', target, propertyKey); + + let aaa = type; + console.log(aaa); + // tagProperty(target, targetKey, metadata); + } + }; +}; + +export default inject; diff --git a/src/ts/@overflow/commons/context/injectable.ts b/src/ts/@overflow/commons/context/decorator/injectable.ts similarity index 100% rename from src/ts/@overflow/commons/context/injectable.ts rename to src/ts/@overflow/commons/context/decorator/injectable.ts diff --git a/src/ts/@overflow/commons/context/inject.ts b/src/ts/@overflow/commons/context/inject.ts deleted file mode 100644 index a5ae2ad..0000000 --- a/src/ts/@overflow/commons/context/inject.ts +++ /dev/null @@ -1,11 +0,0 @@ - -import * as METADATA from './constants'; - - -const inject = (type: TFunction) => { - return (target: Object, propertyKey: string | symbol, parameterIndex?: number): void => { - console.log(''); - }; -}; - -export default inject; diff --git a/src/ts/@overflow/commons/websocket/WebSocketRPC.ts b/src/ts/@overflow/commons/websocket/WebSocketRPC.ts index 79b5aca..7886fc1 100644 --- a/src/ts/@overflow/commons/websocket/WebSocketRPC.ts +++ b/src/ts/@overflow/commons/websocket/WebSocketRPC.ts @@ -9,7 +9,7 @@ import { RPCRequest, RPCResponse, } from './protocol/rpc'; -import { injectable } from 'inversify'; +import injectable from '../context/decorator/injectable'; export type OnConnectFunc = () => void; export type OnDisconnectFunc = () => void;