Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This library allows you to asynchronous load multiple social media client API's
Supports the following APIs:

* Facebook
* Google+
* Tumblr
* Twitter
* Instagram
Expand Down
28 changes: 21 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import typescript from 'rollup-plugin-typescript2';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';

const filenames = ['facebook', 'instagram', 'tumblr', 'twitter', 'vine', 'index'];
const filenames = ['facebook', 'instagram', 'tumblr', 'twitter', 'vine', 'google/plus', 'index'];

export default {
input: `src/index.ts`,
Expand Down
31 changes: 31 additions & 0 deletions src/google/plus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import BaseApi from '../base-api';

declare global {
interface Window {
googlePlusOnLoadCallback: any;
}
}

export default class GooglePlus extends BaseApi {
private gapi?: any;

static get id() {
return 'google-plus';
}

protected async handleLoadApi(): Promise<any> {
return new Promise(async (resolve, reject) => {
window.googlePlusOnLoadCallback = () => {
gapi.load('auth2', () => {
this.gapi = gapi;
resolve(gapi);
});
};
try {
await this.loadScript('https://apis.google.com/js/platform.js?onload=googlePlusOnLoadCallback');
} catch (e) {
reject(e);
}
});
}
}
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import Instagram from './instagram';
import Tumblr from './tumblr';
import Twitter from './twitter';
import Vine from './vine';
import GooglePlus from './google/plus';

export { Facebook, Instagram, Tumblr, Twitter, Vine };
export { Facebook, Instagram, Tumblr, Twitter, Vine, GooglePlus };