Google Calendar for Todayの紹介と拡張内ページ間通信の実例
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Google Calendar for Todayの紹介と拡張内ページ間通信の実例

on

  • 4,146 views

oogle Calendar for Todayの紹介と拡張内ページ間通信の実例 (Chrome Extension TechTalk at 2010-04-09)

oogle Calendar for Todayの紹介と拡張内ページ間通信の実例 (Chrome Extension TechTalk at 2010-04-09)

Statistics

Views

Total Views
4,146
Views on SlideShare
3,936
Embed Views
210

Actions

Likes
0
Downloads
7
Comments
0

4 Embeds 210

http://blog.makotokw.com 188
http://blog.int.makotokw.com 12
http://www.slideshare.net 9
http://www.forest.impress.co.jp 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Google Calendar for Todayの紹介と拡張内ページ間通信の実例 Presentation Transcript

  • 1. Google Calendar for Today Makoto Kawasaki (twitter:@makoto_kw) 2010-04-09 Chrome Extension TechTalk
  • 2. Google Calendar for Today background.html Google Calendar API popup.html Yahoo! Widget DevFest 5.4 j.mp/crxgcaltoday @makoto_kw
  • 3. Lifetime popup.html background.html j.mp/crxgcaltoday @makoto_kw
  • 4. Problem Popup j.mp/crxgcaltoday @makoto_kw
  • 5. Hierarchy popup.html (UI) Google background.html Ajax Calendar (Data) API j.mp/crxgcaltoday @makoto_kw
  • 6. Ex) access data function refreshUI() { var bg = chrome.extension.getBackgroundPage(); var events = bg.events; for (var i=0, len=events.length; i<len; i++) { var e = events[i]; //... } } popup.html window.events = []; background.html j.mp/crxgcaltoday @makoto_kw
  • 7. Ex) notify dataChanged chrome.extension.onRequest.addListener( function(request, sender, sendResponse) { if (request.eventUpdated) { refreshUI(); return; } }); popup.html function fetchEvent() { // $.get('http://....',function(data){ window.events = ["event"]; chrome.extension.sendRequest({eventUpdated:true}); //}); } setInterval(fetchEvent,5*60*1000); background.html j.mp/crxgcaltoday @makoto_kw
  • 8. hack: exetension.getPopupPage() (function () { this.getPopupPage = function() { return this.findWindowByPathname('/popup.html'); } this.findWindowByPathname = function(pathname) { var views = this.getViews(); for (var i=0, len=views.length; i<len; i++) { var w = views[i]; if (w.location.pathname == pathname) { return w; } } } }).apply(chrome.extension,[]); j.mp/crxgcaltoday @makoto_kw
  • 9. Conclusion popup background other -> background getBackgroundPage() background -> other sendRequest()/onRequestListener() j.mp/crxgcaltoday @makoto_kw
  • 10. Reference Example Code: http://github.com/makotokw/crxjptalk_20100409 Google Calendar for Today: http://j.mp/crxgcaltoday Open Source of Google Calendar for Today: http://github.com/makotokw/google-calendar-for-today My Google Calendar (Yahoo! Widget) http://widgets.yahoo.com/widgets/my-google-calendar j.mp/crxgcaltoday @makoto_kw