@osjs/gapi-provider
v1.2.4
Published
Google API Service Provider for OS.js
Downloads
7
Readme
OS.js is an open-source web desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.
OS.js Google API Provider
This is the Google API Provider for OS.js.
Installation
npm install @osjs/gapi-provider
In your client bootstrap file (src/client/index.js
):
import {GapiServiceProvider} from '@osjs/gapi-provider';
osjs.register(GapiServiceProvider, {
args: {
// These are set for you by default
src: 'https://apis.google.com/js/api.js',
libraries: 'client:auth2',
timeout: 30000,
// You have to define these
client: {
apiKey: '',
clientId: '',
discoveryDocs: [],
scope: []
}
}
});
Usage
For example in an application:
const osjsgapi = core.make('osjs/gapi').create();
osjsgapi.on('signed-in', () => console.log('You were signed in'));
osjsgapi.on('signed-out', () => console.log('You were signed out'));
osjsgapi.login().then(gapi => {
// Do whatever
});
proc.on('destroy', () => osjsgapi.destroy());
Contribution
- Sponsor on Github
- Become a Patreon
- Support on Open Collective
- Contribution Guide
Documentation
See the Official Manuals for articles, tutorials and guides.