codecombat/app/lib/services/google.coffee

17 lines
551 B
CoffeeScript
Raw Normal View History

module.exports = initializeGoogle = ->
2014-06-24 14:29:43 -04:00
window.onGPlusLoaded = ->
Backbone.Mediator.publish "gapi-loaded"
return
2014-06-24 14:29:43 -04:00
window.signinCallback = (authResult) ->
Backbone.Mediator.publish "gplus-logged-in", authResult if authResult["access_token"]
return
(->
po = document.createElement("script")
po.type = "text/javascript"
po.async = true
po.src = "https://apis.google.com/js/client:plusone.js?onload=onGPlusLoaded"
s = document.getElementsByTagName("script")[0]
s.parentNode.insertBefore po, s
return
)()