app/api/external/google/drive/example/script.js
function initClient() {
	gapi.client.init({
		apiKey: config.api.google.web.key,
		clientId: config.api.google.web.client_id,
		discoveryDocs: DISCOVERY_DOCS,
		scope: SCOPES
	}).then(function () {
		// Listen for sign-in state changes.
		gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);

		// Handle the initial sign-in state.
		updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
		authorizeButton.onclick = handleAuthClick;
		signoutButton.onclick = handleSignoutClick;
	}, function(error) {
		appendPre(JSON.stringify(error, null, 2));
	});
}
function initClient() {
	gapi.client.init({
		apiKey: config.api.google.web.key,
		clientId: config.api.google.web.client_id,
		discoveryDocs: DISCOVERY_DOCS,
		scope: SCOPES
	}).then(function () {
		// Listen for sign-in state changes.
		gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);

		// Handle the initial sign-in state.
		updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
		authorizeButton.onclick = handleAuthClick;
		signoutButton.onclick = handleSignoutClick;
	}, function(error) {
		appendPre(JSON.stringify(error, null, 2));
	});
}
function initClient ( ) { gapi . client . init ( { apiKey : config . api . google . web . key , clientId : config . api . google . web . client_id , discoveryDocs : DISCOVERY_DOCS , scope : SCOPES } ) . then ( function ( ) { // Listen for sign-in state changes. gapi . auth2 . getAuthInstance ( ) . isSignedIn . listen ( updateSigninStatus ) ; // Handle the initial sign-in state. updateSigninStatus ( gapi . auth2 . getAuthInstance ( ) . isSignedIn . get ( ) ) ; authorizeButton . onclick = handleAuthClick ; signoutButton . onclick = handleSignoutClick ; } , function ( error ) { appendPre ( JSON . stringify ( error , null , 2 ) ) ; } ) ; }
Initializes the API client library and sets up sign-in state
listeners.
Initializes the API client library and sets up sign - in state listeners .