All Projects → sindresorhus → Do Not Disturb

sindresorhus / Do Not Disturb

Licence: mit
Control the macOS `Do Not Disturb` feature

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Do Not Disturb

Ngx Config
Configuration utility for Angular
Stars: ✭ 135 (-12.9%)
Mutual labels:  npm-package
Alfred Vscode
Alfred 3 workflow that allows you to browse and open Visual Studio Code projects or simply open specified folders/files
Stars: ✭ 141 (-9.03%)
Mutual labels:  npm-package
Kafkajs
A modern Apache Kafka client for node.js
Stars: ✭ 2,315 (+1393.55%)
Mutual labels:  npm-package
Handlebars Webpack Plugin
Renders your html-template at build time
Stars: ✭ 135 (-12.9%)
Mutual labels:  npm-package
Mdme
Self-rendering Markdown content
Stars: ✭ 140 (-9.68%)
Mutual labels:  npm-package
Ngx Cache
Cache utility for Angular
Stars: ✭ 144 (-7.1%)
Mutual labels:  npm-package
Ink Link
Link component for Ink
Stars: ✭ 133 (-14.19%)
Mutual labels:  npm-package
Transliterate
Convert Unicode characters to Latin characters using transliteration
Stars: ✭ 152 (-1.94%)
Mutual labels:  npm-package
Texme
Self-rendering Markdown + LaTeX documents
Stars: ✭ 1,970 (+1170.97%)
Mutual labels:  npm-package
Tsconfig
Shared TypeScript config for my projects
Stars: ✭ 146 (-5.81%)
Mutual labels:  npm-package
To Milliseconds
Convert an object of time properties to milliseconds: `{seconds: 2}` → `2000`
Stars: ✭ 136 (-12.26%)
Mutual labels:  npm-package
Create React Component Folder
Creates react component folder structure
Stars: ✭ 139 (-10.32%)
Mutual labels:  npm-package
React Bnb Gallery
Simple react-based photo gallery inspired by Airbnb image gallery.
Stars: ✭ 145 (-6.45%)
Mutual labels:  npm-package
Ag Psd
Javascript library for reading and writing PSD files
Stars: ✭ 135 (-12.9%)
Mutual labels:  npm-package
Homebridge Wol
A Wake on Lan plugin for Homebridge
Stars: ✭ 150 (-3.23%)
Mutual labels:  npm-package
Ohshitgit
⁉️Oh shit! A cli tool to help you unfuck your git mistakes
Stars: ✭ 135 (-12.9%)
Mutual labels:  npm-package
Csv Writer
Convert objects/arrays into a CSV string or write them into a CSV file
Stars: ✭ 140 (-9.68%)
Mutual labels:  npm-package
Gloria
Gloria is a static website generator, based on NodeJS.
Stars: ✭ 153 (-1.29%)
Mutual labels:  npm-package
Inspirational Quotes
💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸
Stars: ✭ 150 (-3.23%)
Mutual labels:  npm-package
Aws Lambda Libreoffice
85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli
Stars: ✭ 145 (-6.45%)
Mutual labels:  npm-package

do-not-disturb

Control the macOS Do Not Disturb feature

Note that this package does not work inside a sandboxed app.

Install

$ npm install @sindresorhus/do-not-disturb

Usage

import doNotDisturb from '@sindresorhus/do-not-disturb';

await doNotDisturb.enable();

API

doNotDisturb

All the methods return a Promise. You only really need to await them if you use multiple methods at once.

.enable(): Promise<void>

.disable(): Promise<void>

.toggle(force?): Promise<void>

force

Type: boolean

Force it to be enabled/disabled.

.isEnabled(): Promise<boolean>

.on('change', listener, options): EventEmitter

Attach an event listener that gets called when the "Do Not Disturb" state changes.

options

Type: object

pollInterval

Type: number
Default: 3000

Interval in milliseconds at which the polling for the change event is made.

.off('change', listener): EventEmitter

Remove an event listener that was attached previously.

import doNotDisturb from '@sindresorhus/do-not-disturb';

const listener = status => {
	console.log(`Do Not Disturb status: ${status}`);
}

doNotDisturb.on('change', listener, {pollInterval: 100});

// …

doNotDisturb.off('change', listener);

Related

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].