codecombat/app/core/services/google.coffee

17 lines
572 B
CoffeeScript
Raw Normal View History

module.exports = initializeGoogle = ->
2014-06-24 14:29:43 -04:00
window.onGPlusLoaded = ->
Backbone.Mediator.publish 'auth:gplus-api-loaded', {}
return
2014-06-24 14:29:43 -04:00
window.signinCallback = (authResult) ->
Backbone.Mediator.publish 'auth:logged-in-with-gplus', authResult if authResult.access_token
return
(->
2014-06-30 22:16:26 -04:00
po = document.createElement('script')
po.type = 'text/javascript'
po.async = true
2015-02-13 14:18:00 -05:00
po.src = 'https://apis.google.com/js/client:platform.js?onload=onGPlusLoaded'
2014-06-30 22:16:26 -04:00
s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore po, s
return
)()