Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 2.62 KB

README.md

File metadata and controls

81 lines (60 loc) · 2.62 KB

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