Created
May 29, 2013 16:18
-
-
Save t-kashima/5671568 to your computer and use it in GitHub Desktop.
Google Cloud Messaging for Chrome Demo
- http://www.atmarkit.co.jp/ait/articles/1305/24/news014.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log 'backgroud.js is working!!!!!!' | |
chrome.pushMessaging.onMessage.addListener (message) -> | |
alert 'GCM message: ' + message.payload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script type="text/javascript" src="background.js" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "GCM Demo", | |
"version": "1.0.2", | |
"manifest_version": 2, | |
"description": "GCM for Chrome Extension Demo", | |
"browser_action": { | |
"default_title": "GCM Demo", | |
"default_popup": "popup.html" | |
}, | |
"background": { | |
"page": "background.html" | |
}, | |
"permissions": ["background", "pushMessaging"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elementTextChannelId = document.querySelector '#textChannelId' | |
console.log 'Hello, Chrome Extension' | |
chrome.pushMessaging.getChannelId false, (response) -> | |
elementTextChannelId.value = response.channelId |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype 5 | |
html | |
head | |
meta charset="UTF-8" | |
title GCM for Chrome | |
body | |
h1 Hello, GCM for Chrome | |
div channelId: | |
input type="text" size="120" id="textChannelId" | |
script type="text/javascript" src="popup.js" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment