@osjs/gapi-provider

1.2.4 • Public • Published

OS.js Logo

OS.js is an open-source web desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.

Support Support Donate Donate Community

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

Documentation

See the Official Manuals for articles, tutorials and guides.

Links

Readme

Keywords

Package Sidebar

Install

npm i @osjs/gapi-provider

Weekly Downloads

0

Version

1.2.4

License

MIT

Unpacked Size

43.8 kB

Total Files

6

Last publish

Collaborators

  • andersevenrud