forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfacebook-js-sdk.d.ts
90 lines (83 loc) · 2.88 KB
/
facebook-js-sdk.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Type definitions for the Facebook Javascript SDK
// Project: https://developers.facebook.com/docs/javascript
// Definitions by: Amrit Kahlon <https://github.com/amritk/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import fb = facebook;
declare var FB: fb.FacebookStatic;
declare namespace facebook {
interface FacebookStatic {
// api: any;
// AppEvents: any;
// Canvas: any;
// Event: any;
/**
* The method FB.getAuthResponse() is a synchronous accessor for the current authResponse.
* The synchronous nature of this method is what sets it apart from the other login methods.
*
* @param callback function to handle the response.
*/
getAuthResponse(callback: (response: AuthResponse) => void): void;
/**
* FB.getLoginStatus() allows you to determine if a user is
* logged in to Facebook and has authenticated your app.
*
* @param callback function to handle the response.
*/
getLoginStatus(callback: (response: AuthResponse) => void): void;
/**
* The method FB.init() is used to initialize and setup the SDK.
*
* @param params params for the initialization.
*/
init(params: InitParams): void;
/**
* Use this function to log the user in
*
* Calling FB.login() results in the JS SDK attempting to open a popup window.
* As such, this method should only be called after a user click event, otherwise
* the popup window will be blocked by most browsers.
*
* @param callback function to handle the response.
* @param options optional ILoginOption to add params such as scope.
*/
login(callback: (response: AuthResponse) => void, options?: LoginOptions): void;
/**
* The method FB.logout() logs the user out of your site and, in some cases, Facebook.
*
* @param callback function to handle the response
*/
logout(callback: (response: AuthResponse) => void): void;
// ui: any;
// XFBML: any;
}
interface InitParams {
appId: string;
version?: string;
cookie?: boolean;
status?: boolean;
xfbml?: boolean;
frictionlessRequests?: boolean;
hideFlashCallback?: boolean;
}
interface LoginOptions {
auth_type?: string;
scope?: string;
return_scopes?: boolean;
enable_profile_selector?: boolean;
profile_selector_ids?: string;
}
////////////////////////
//
// RESPONSES
//
////////////////////////
interface AuthResponse {
status: string;
authResponse: {
accessToken: string;
expiresIn: number;
signedRequest: string;
userID: string;
}
}
}