1.2.4 • Published 4 years ago

@osjs/gapi-provider v1.2.4

Weekly downloads
26
License
MIT
Repository
github
Last release
4 years ago

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

1.2.4

4 years ago

1.2.3

5 years ago

1.2.2

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago