UNPKG

2.81 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Twitter Connect
11 * @description
12 * Plugin to use Twitter Single Sign On
13 * Uses Twitter's Fabric SDK
14 * ```typescript
15 * import {TwitterConnect} from 'ionic-native';
16 *
17 * function onSuccess(response) {
18 * console.log(response);
19 *
20 * // Will console log something like:
21 * // {
22 * // userName: 'myuser',
23 * // userId: '12358102',
24 * // secret: 'tokenSecret'
25 * // token: 'accessTokenHere'
26 * // }
27 * }
28 *
29 * TwitterConnect.login().then(onSuccess, onError);
30 *
31 * TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
32 * ```
33 * @interfaces
34 * TwitterConnectResponse
35 */
36var TwitterConnect = (function () {
37 function TwitterConnect() {
38 }
39 /**
40 * Logs in
41 * @returns {Promise<TwitterConnectResponse>} returns a promise that resolves if logged in and rejects if failed to login
42 */
43 TwitterConnect.login = function () { return; };
44 /**
45 * Logs out
46 * @returns {Promise<any>} returns a promise that resolves if logged out and rejects if failed to logout
47 */
48 TwitterConnect.logout = function () { return; };
49 /**
50 * Returns user's profile information
51 * @returns {Promise<any>} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails
52 */
53 TwitterConnect.showUser = function () { return; };
54 __decorate([
55 plugin_1.Cordova()
56 ], TwitterConnect, "login", null);
57 __decorate([
58 plugin_1.Cordova()
59 ], TwitterConnect, "logout", null);
60 __decorate([
61 plugin_1.Cordova()
62 ], TwitterConnect, "showUser", null);
63 TwitterConnect = __decorate([
64 plugin_1.Plugin({
65 pluginName: 'TwitterConnect',
66 plugin: 'twitter-connect-plugin',
67 pluginRef: 'TwitterConnect',
68 repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
69 install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
70 })
71 ], TwitterConnect);
72 return TwitterConnect;
73}());
74exports.TwitterConnect = TwitterConnect;
75//# sourceMappingURL=twitter-connect.js.map
\No newline at end of file