From 432cca3d5128aad8cfdea95ef5c8ced8b6093ef2 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:11:04 +0200 Subject: [PATCH 1/9] Create hellojs hello.js --- hellojs | 1 + 1 file changed, 1 insertion(+) create mode 100644 hellojs diff --git a/hellojs b/hellojs new file mode 100644 index 000000000..d39ed33aa --- /dev/null +++ b/hellojs @@ -0,0 +1 @@ +Enter file contents heressss From 943046170f2f6f9580c48b0c3fa4dcf835f821dd Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:11:38 +0200 Subject: [PATCH 2/9] Delete hellojs --- hellojs | 1 - 1 file changed, 1 deletion(-) delete mode 100644 hellojs diff --git a/hellojs b/hellojs deleted file mode 100644 index d39ed33aa..000000000 --- a/hellojs +++ /dev/null @@ -1 +0,0 @@ -Enter file contents heressss From 78f213ddfb8386881581d148a193ac4e83a41d78 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:14:56 +0200 Subject: [PATCH 3/9] First version --- hellojs/hellojs.d.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 hellojs/hellojs.d.ts diff --git a/hellojs/hellojs.d.ts b/hellojs/hellojs.d.ts new file mode 100644 index 000000000..bafa529de --- /dev/null +++ b/hellojs/hellojs.d.ts @@ -0,0 +1,67 @@ +// Type definitions for hello.js 0.2.1 +// Project: http://knockoutjs.com +// Definitions by: Pavel Zika +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface HelloJSLoginOptions { + redirect_uri?: string; + display?: string; + scope?: string; + response_type?: string; + force?: boolean; + oauth_proxy?: string; + timeout?: number; + default_service?: string; +} + +interface HelloJSEventArgument { + network: string; + authResponse?: any; +} + +interface HelloJSStatic { + init(serviceAppIds: { [id: string]: string; }, defaultOptions?: HelloJSLoginOptions); + login(network: string, option?: HelloJSLoginOptions, callback?: () => void); + logout(network: string, callback?: () => void); + on(eventName: string, event: (auth: HelloJSEventArgument) => void): HelloJSStatic; + off(eventName: string, event: (auth: HelloJSEventArgument) => void): HelloJSStatic; + getAuthResponse(network: string): any; + service(network: string): any; + settings: HelloJSLoginOptions; + (network: string): HelloJSStaticNamed; + init(servicesDef: { [id: string]: HelloJSServiceDef; }); +} + +interface HelloJSStaticNamed { + login(option?: HelloJSLoginOptions, callback?: () => void); + logout(callback?: () => void); + getAuthResponse(): any; +} + +interface HelloJSOAuthDef { + version: number; + auth: string; + request: string; + token: string; +} + +interface HelloJSServiceDef { + name: string; + oauth: HelloJSOAuthDef; + scope?: { [id: string]: string; }; + scope_delim?: string; + autorefresh?: boolean; + base?: string; + root?: string; + get?: { [id: string]: any; } + post?: { [id: string]: any; } + del?: { [id: string]: string; } + put?: { [id: string]: any; } + wrap?: { [id: string]: (par: any) => void; } + xhr?: (par: any) => void; + jsonp?: (par: any) => void; + form?: (par: any) => void; + api?: (...par: any[]) => void; +} + +declare var hello: HelloJSStatic; From 70859516bbd66fc50728f074ddacb8b4a711d259 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:20:24 +0200 Subject: [PATCH 4/9] First version --- hellojs/hellojs-test.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 hellojs/hellojs-test.ts diff --git a/hellojs/hellojs-test.ts b/hellojs/hellojs-test.ts new file mode 100644 index 000000000..fbe36ce66 --- /dev/null +++ b/hellojs/hellojs-test.ts @@ -0,0 +1,30 @@ +hello.init( + { + 'facebook': '', + }, + { + redirect_uri: 'hello.html', + display: 'page', + } + ); + +hello('facebook').login(); + +hello('facebook').logout(); + +hello.on('auth.login', auth => { + alert('log to ' + auth.network) +}).on('auth.logout', auth => { + alert('unlog from ' + auth.network) + }); + +hello.getAuthResponse('facebook'); + +hello.login('facebook', null, () => { + var req = hello.getAuthResponse('facebook'); +}); + +hello.logout('facebook'); + +var serviceInfo = hello.service('facebook'); + From 0ae5dd994060d8a5c8b7a64d76fe3828c936d916 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:29:00 +0200 Subject: [PATCH 5/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8f5708c20..0e8ca78c5 100755 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ List of Definitions * [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [HashSet](http://www.timdown.co.uk/jshashtable/jshashset.html) (by [Sergey Gerasimov](https://github.com/gerich-home)) * [Hashtable](http://www.timdown.co.uk/jshashtable/) (by [Sergey Gerasimov](https://github.com/gerich-home)) +* [HelloJS](http://adodson.com/hello.js) (by [Pavel Zika](https://github.com/PavelPZ)) * [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog)) * [Highland](http://highlandjs.org/) (by [Bart van der Schoor](https://github.com/Bartvds/)) * [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee)) From c876e1bfe51202725f944be0055859c347b4aec6 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:33:49 +0200 Subject: [PATCH 6/9] Update hellojs.d.ts --- hellojs/hellojs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hellojs/hellojs.d.ts b/hellojs/hellojs.d.ts index bafa529de..010264ffb 100644 --- a/hellojs/hellojs.d.ts +++ b/hellojs/hellojs.d.ts @@ -1,5 +1,5 @@ // Type definitions for hello.js 0.2.1 -// Project: http://knockoutjs.com +// Project: http://adodson.com/hello.js // Definitions by: Pavel Zika // Definitions: https://github.com/borisyankov/DefinitelyTyped From 4051a55c9ffc48ff4c15b5513fd0ba5017540f42 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:40:45 +0200 Subject: [PATCH 7/9] Update hellojs.d.ts --- hellojs/hellojs.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hellojs/hellojs.d.ts b/hellojs/hellojs.d.ts index 010264ffb..7727f667e 100644 --- a/hellojs/hellojs.d.ts +++ b/hellojs/hellojs.d.ts @@ -1,5 +1,5 @@ // Type definitions for hello.js 0.2.1 -// Project: http://adodson.com/hello.js +// Project: http://knockoutjs.com // Definitions by: Pavel Zika // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -20,21 +20,21 @@ interface HelloJSEventArgument { } interface HelloJSStatic { - init(serviceAppIds: { [id: string]: string; }, defaultOptions?: HelloJSLoginOptions); - login(network: string, option?: HelloJSLoginOptions, callback?: () => void); - logout(network: string, callback?: () => void); + init(serviceAppIds: { [id: string]: string; }, defaultOptions?: HelloJSLoginOptions):void; + login(network: string, option?: HelloJSLoginOptions, callback?: () => void): void; + logout(network: string, callback?: () => void): void; on(eventName: string, event: (auth: HelloJSEventArgument) => void): HelloJSStatic; off(eventName: string, event: (auth: HelloJSEventArgument) => void): HelloJSStatic; getAuthResponse(network: string): any; - service(network: string): any; + service(network: string): HelloJSServiceDef; settings: HelloJSLoginOptions; (network: string): HelloJSStaticNamed; - init(servicesDef: { [id: string]: HelloJSServiceDef; }); + init(servicesDef: { [id: string]: HelloJSServiceDef; }): void; } interface HelloJSStaticNamed { - login(option?: HelloJSLoginOptions, callback?: () => void); - logout(callback?: () => void); + login(option?: HelloJSLoginOptions, callback?: () => void): void; + logout(callback?: () => void): void; getAuthResponse(): any; } From 12506f5e36d2af155e721e98e885eec81c417b43 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 13:42:15 +0200 Subject: [PATCH 8/9] Update hellojs-test.ts --- hellojs/hellojs-test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hellojs/hellojs-test.ts b/hellojs/hellojs-test.ts index fbe36ce66..ef0508867 100644 --- a/hellojs/hellojs-test.ts +++ b/hellojs/hellojs-test.ts @@ -1,3 +1,5 @@ +/// + hello.init( { 'facebook': '', From 3a018f7d72bc07109d929aa0d1592f08e4b778b2 Mon Sep 17 00:00:00 2001 From: Pavel Zika Date: Tue, 15 Apr 2014 14:14:37 +0200 Subject: [PATCH 9/9] Update hellojs.d.ts --- hellojs/hellojs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hellojs/hellojs.d.ts b/hellojs/hellojs.d.ts index 7727f667e..a95b80a93 100644 --- a/hellojs/hellojs.d.ts +++ b/hellojs/hellojs.d.ts @@ -1,5 +1,5 @@ // Type definitions for hello.js 0.2.1 -// Project: http://knockoutjs.com +// Project: http://adodson.com/hello.js/ // Definitions by: Pavel Zika // Definitions: https://github.com/borisyankov/DefinitelyTyped