Thursday, October 18, 2012

Alarms API

I have made a simple demonstration of all available methods, properties and events of Alarms API.
Manifest File:

 "name":"Chrome Alarms Demonstration",
 "description":"This is a sample demo for Chrome Alarms API",

HTML File:

<script src="popup.js"></script>
<p id="alarmp">Simple Demonstation, Check Console Log for detailed descriptions</p>

JS File:

function createalarm(){
chrome.alarms.create("My First Alarm",{delayInMinutes:0.25,periodInMinutes:0.125 });
chrome.alarms.get("My First Alarm",function(alarm){
console.log("Scheduled Time  "+ alarm.scheduledTime);
console.log("Alarm Name ";
console.log("Scheduled Time  "+alarms[0].scheduledTime);
console.log("Alarm Name "+alarms[0].name);
console.log("Alarm Elapsed Name ";
console.log("This is Over");
chrome.alarms.clear("My First Alarm");
alert(" Alarms Cleared");
//chrome.alarms.clear("My First Alarm");


1 comment: