Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

chrome-alarms

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

chrome-alarms

Helper for chrome.alarms API.

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

chrome-alarms

npm version build License

ko-fi

Overview

Helper for chrome.alarms API.

Notes

To use the chrome.alarms API, declare the "alarms" permission in the manifest:

{
  "name": "My extension",

  "permissions": ["alarms"]
}

Installation

You can install this library using npm:

npm install chrome-alarms

Properties

KeyTypeOptionalDescription
namestringName of this alarm.
periodInMinutesnumberIf not null, the alarm is a repeating alarm and will fire again in periodInMinutes minutes.

Methods

create

Creates an alarm. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.

import { Alarm } from "chrome-alarms";

const name = "test";
const periodInMinutes = 1;

await Alarm.create(name, periodInMinutes);

clear

Clears the alarm with the given name.

import { Alarm } from "chrome-alarms";

const name = "test";

await Alarm.clear(name);

clearAll

Clears all alarms.

import { Alarm } from "chrome-alarms";

await Alarm.clearAll();

get

Retrieves details about the specified alarm.

import { Alarm } from "chrome-alarms";

const name = "test";

const alarm = await Alarm.get(name);
console.log(alarm);

// Output: Object{ name: "test", periodInMinutes: 1, scheduledTime: 1706435598914.826 }

getAll

Gets an array of all the alarms.

import { Alarm } from "chrome-alarms";

const alarms = await Alarm.getAll();
console.log(alarms);

// Output: Array[{ name: "test", periodInMinutes: 1, scheduledTime: 1706435598914.826 }]
  • chrome.alarms

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

chrome

FAQs

Package last updated on 31 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts