SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
實作小玩具功能
Chrome Desktop Notification




Bruce
2012/7/13
雲端線上科技股份有限公司
Desktop Notification

      像這樣的:
Require permission
                                    必須綁在user操作(例如click)上

<script>
	
  	
  $("#request-­‐permission").click(function()	
  {
	
  	
  	
  	
  //	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0	
  is	
  PERMISSION_ALLOWED	
  ↓
	
  	
  	
  	
  if	
  (window.webkitNotifications.checkPermission()	
  !=	
  0)	
  {
	
  	
  	
  	
  	
  	
  window.webkitNotifications.requestPermission();
	
  	
  	
  	
  }
	
  	
  });
</script>
產生Notification

<script>
	
  	
  var	
  popup	
  =	
  window.webkitNotifications.createNotification(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "icon.png",	
  "greet",	
  "hello	
  world"	
  );
	
  	
  popup.show();
</script>
HTML Notification

<script>
	
  	
  var	
  popup	
  =	
  window.webkitNotifications.createHTMLNotification(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "http://www.myoops.org/main.php"	
  );
	
  	
  popup.show();
</script>
替換notification
替換notification
替換notification
<script>
	
  	
  var	
  popup	
  =	
  window.webkitNotifications.createNotification(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "icon.png",	
  "greet",	
  "hello	
  world"	
  );
	
  	
  popup.show();
                                                     重點
	
  	
  popup.cancel();
	
  	
  popup	
  =	
  window.webkitNotifications.createNotification(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "icon.png",	
  "greet",	
  "又⼀一則新訊息"	
  );
	
  	
  popup.show();
</script>
按⼀一下切換到該tab

<script>
	
  	
  var	
  popup	
  =	
  window.webkitNotifications.createNotification(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  "icon.png",	
  "greet",	
  "hello	
  world"	
  );
	
  	
  popup.onclick	
  =	
  function(){	
  window.focus();	
  popup.cancel();	
  }
	
  	
  popup.show();
</script>



                                              切換到該tab
                                                                     順便把notification關掉
播放音效

• 我還沒實作到這塊
• 原理是在 ondisplay event 播放聲音
• Google 是使用flash播放聲音
Notification interface

  interface	
  Notification	
  :	
  EventTarget	
  {
  	
  	
  //	
  display	
  methods
  	
  	
  void	
  show();
  	
  	
  void	
  cancel();

  	
  	
  //	
  event	
  handler	
  attributes
  	
  	
  attribute	
  Function	
  ondisplay;
  	
  	
  attribute	
  Function	
  onerror;
  	
  	
  attribute	
  Function	
  onclose;
  	
  	
  attribute	
  Function	
  onclick;
  }
官方API文件


• http://dev.chromium.org/developers/design-
  documents/desktop-notifications/api-
  specification

Más contenido relacionado

La actualidad más candente

Diseño de Sistemas de Diseño con Atomic Design y Pattern Lab
Diseño de Sistemas de Diseño con Atomic Design y Pattern LabDiseño de Sistemas de Diseño con Atomic Design y Pattern Lab
Diseño de Sistemas de Diseño con Atomic Design y Pattern LabMauricio Angulo Sillas
 
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web DevelopmentMocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web DevelopmentESUG
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorialClaude Tech
 
UI5 Controls (UI5con 2016)
UI5 Controls (UI5con 2016)UI5 Controls (UI5con 2016)
UI5 Controls (UI5con 2016)Andreas Kunz
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile ProcessEyal Vardi
 

La actualidad más candente (7)

Diseño de Sistemas de Diseño con Atomic Design y Pattern Lab
Diseño de Sistemas de Diseño con Atomic Design y Pattern LabDiseño de Sistemas de Diseño con Atomic Design y Pattern Lab
Diseño de Sistemas de Diseño con Atomic Design y Pattern Lab
 
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web DevelopmentMocks, Proxies, and Transpilation as Development Strategies for Web Development
Mocks, Proxies, and Transpilation as Development Strategies for Web Development
 
Angular JS blog tutorial
Angular JS blog tutorialAngular JS blog tutorial
Angular JS blog tutorial
 
UI5 Controls (UI5con 2016)
UI5 Controls (UI5con 2016)UI5 Controls (UI5con 2016)
UI5 Controls (UI5con 2016)
 
Desarrollo Sostenible Informatica
Desarrollo Sostenible InformaticaDesarrollo Sostenible Informatica
Desarrollo Sostenible Informatica
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
 
AngularJS Compile Process
AngularJS Compile ProcessAngularJS Compile Process
AngularJS Compile Process
 

Similar a 006 實作小玩具功能:chrome desktop notification

Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 Cutting edge HTML5 API you can use today (by Bohdan Rusinka) Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)Binary Studio
 
Firefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next levelFirefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next levelFrédéric Harper
 
Developing AIR for Android with Flash Professional
Developing AIR for Android with Flash ProfessionalDeveloping AIR for Android with Flash Professional
Developing AIR for Android with Flash ProfessionalChris Griffith
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupWes Yanaga
 
The Mouse is mightier than the sword
The Mouse is mightier than the swordThe Mouse is mightier than the sword
The Mouse is mightier than the swordPriyanka Aash
 
Lecture: Vaadin Overview
Lecture: Vaadin OverviewLecture: Vaadin Overview
Lecture: Vaadin OverviewJoonas Lehtinen
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonRobert Nyman
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widgetTudor Barbu
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - MozillaRobert Nyman
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07Frédéric Harper
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSRobert Nyman
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Frédéric Harper
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...Robert Nyman
 
Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)Nordic APIs
 
Detecting headless browsers
Detecting headless browsersDetecting headless browsers
Detecting headless browsersSergey Shekyan
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018Tobias Schneck
 

Similar a 006 實作小玩具功能:chrome desktop notification (20)

Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 Cutting edge HTML5 API you can use today (by Bohdan Rusinka) Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 
JavaScript: Events Handling
JavaScript: Events HandlingJavaScript: Events Handling
JavaScript: Events Handling
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Firefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next levelFirefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next level
 
Developing AIR for Android with Flash Professional
Developing AIR for Android with Flash ProfessionalDeveloping AIR for Android with Flash Professional
Developing AIR for Android with Flash Professional
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 Lightup
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
The Mouse is mightier than the sword
The Mouse is mightier than the swordThe Mouse is mightier than the sword
The Mouse is mightier than the sword
 
Lecture: Vaadin Overview
Lecture: Vaadin OverviewLecture: Vaadin Overview
Lecture: Vaadin Overview
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)
 
Detecting headless browsers
Detecting headless browsersDetecting headless browsers
Detecting headless browsers
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
 

Más de Bruce Li

RSpec best practice - avoid using before and let
RSpec best practice - avoid using before and letRSpec best practice - avoid using before and let
RSpec best practice - avoid using before and letBruce Li
 
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxyUnlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxyBruce Li
 
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)Bruce Li
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Bruce Li
 
011 優化時間分配的 app 跟心得
011 優化時間分配的 app 跟心得011 優化時間分配的 app 跟心得
011 優化時間分配的 app 跟心得Bruce Li
 
Rails Code Club 3 @ Taipei
Rails Code Club 3 @ TaipeiRails Code Club 3 @ Taipei
Rails Code Club 3 @ TaipeiBruce Li
 
Rails Code Club 2 @ Taipei
Rails Code Club 2 @ TaipeiRails Code Club 2 @ Taipei
Rails Code Club 2 @ TaipeiBruce Li
 
010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談Bruce Li
 
009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2Bruce Li
 
008 vim超基礎入門
008 vim超基礎入門008 vim超基礎入門
008 vim超基礎入門Bruce Li
 
007 Facebook Open Graph 相關開發簡單介紹 公開版
007 Facebook Open Graph 相關開發簡單介紹 公開版007 Facebook Open Graph 相關開發簡單介紹 公開版
007 Facebook Open Graph 相關開發簡單介紹 公開版Bruce Li
 
004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得Bruce Li
 
003 Ruby小觀念與小技巧Part2
003 Ruby小觀念與小技巧Part2003 Ruby小觀念與小技巧Part2
003 Ruby小觀念與小技巧Part2Bruce Li
 
002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定Bruce Li
 
001 Ruby小觀念與小技巧
001 Ruby小觀念與小技巧001 Ruby小觀念與小技巧
001 Ruby小觀念與小技巧Bruce Li
 

Más de Bruce Li (15)

RSpec best practice - avoid using before and let
RSpec best practice - avoid using before and letRSpec best practice - avoid using before and let
RSpec best practice - avoid using before and let
 
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxyUnlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxy
 
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)
 
011 優化時間分配的 app 跟心得
011 優化時間分配的 app 跟心得011 優化時間分配的 app 跟心得
011 優化時間分配的 app 跟心得
 
Rails Code Club 3 @ Taipei
Rails Code Club 3 @ TaipeiRails Code Club 3 @ Taipei
Rails Code Club 3 @ Taipei
 
Rails Code Club 2 @ Taipei
Rails Code Club 2 @ TaipeiRails Code Club 2 @ Taipei
Rails Code Club 2 @ Taipei
 
010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談010 Better and Better 工程師就業兩年多的心得雜談
010 Better and Better 工程師就業兩年多的心得雜談
 
009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2009 增進效率的雜七雜八mac快速鍵與設定 part 2
009 增進效率的雜七雜八mac快速鍵與設定 part 2
 
008 vim超基礎入門
008 vim超基礎入門008 vim超基礎入門
008 vim超基礎入門
 
007 Facebook Open Graph 相關開發簡單介紹 公開版
007 Facebook Open Graph 相關開發簡單介紹 公開版007 Facebook Open Graph 相關開發簡單介紹 公開版
007 Facebook Open Graph 相關開發簡單介紹 公開版
 
004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得004 動機 單純的力量 讀書心得
004 動機 單純的力量 讀書心得
 
003 Ruby小觀念與小技巧Part2
003 Ruby小觀念與小技巧Part2003 Ruby小觀念與小技巧Part2
003 Ruby小觀念與小技巧Part2
 
002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定002 增進效率的有的沒的快速鍵與設定
002 增進效率的有的沒的快速鍵與設定
 
001 Ruby小觀念與小技巧
001 Ruby小觀念與小技巧001 Ruby小觀念與小技巧
001 Ruby小觀念與小技巧
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

006 實作小玩具功能:chrome desktop notification

  • 2. Desktop Notification 像這樣的:
  • 3. Require permission 必須綁在user操作(例如click)上 <script>    $("#request-­‐permission").click(function()  {        //                                                    0  is  PERMISSION_ALLOWED  ↓        if  (window.webkitNotifications.checkPermission()  !=  0)  {            window.webkitNotifications.requestPermission();        }    }); </script>
  • 4. 產生Notification <script>    var  popup  =  window.webkitNotifications.createNotification(                                  "icon.png",  "greet",  "hello  world"  );    popup.show(); </script>
  • 5. HTML Notification <script>    var  popup  =  window.webkitNotifications.createHTMLNotification(                                  "http://www.myoops.org/main.php"  );    popup.show(); </script>
  • 8. 替換notification <script>    var  popup  =  window.webkitNotifications.createNotification(                                  "icon.png",  "greet",  "hello  world"  );    popup.show(); 重點    popup.cancel();    popup  =  window.webkitNotifications.createNotification(                                  "icon.png",  "greet",  "又⼀一則新訊息"  );    popup.show(); </script>
  • 9. 按⼀一下切換到該tab <script>    var  popup  =  window.webkitNotifications.createNotification(                                  "icon.png",  "greet",  "hello  world"  );    popup.onclick  =  function(){  window.focus();  popup.cancel();  }    popup.show(); </script> 切換到該tab 順便把notification關掉
  • 10. 播放音效 • 我還沒實作到這塊 • 原理是在 ondisplay event 播放聲音 • Google 是使用flash播放聲音
  • 11. Notification interface interface  Notification  :  EventTarget  {    //  display  methods    void  show();    void  cancel();    //  event  handler  attributes    attribute  Function  ondisplay;    attribute  Function  onerror;    attribute  Function  onclose;    attribute  Function  onclick; }
  • 12. 官方API文件 • http://dev.chromium.org/developers/design- documents/desktop-notifications/api- specification