Comparing version 4.3.0 to 4.4.0
133
index.d.ts
@@ -1,32 +0,34 @@ | ||
export interface GetOptions { | ||
/** | ||
* **macOS only.** | ||
* | ||
* The screen to get the wallpaper from. Values: `all` `main` or the index of a screen from `.screens()`. | ||
* | ||
* @default 'main' | ||
*/ | ||
readonly screen?: 'all' | 'main' | number; | ||
} | ||
declare namespace wallpaper { | ||
interface GetOptions { | ||
/** | ||
__macOS only.__ | ||
export interface SetOptions { | ||
/** | ||
* **macOS only.** | ||
* | ||
* The screen to set the wallpaper on. Values: `all` `main` or the index of a screen from `.screens()`. | ||
* | ||
* *On Linux and Windows it's hard-coded to `main`.* | ||
* | ||
* @default 'all' | ||
*/ | ||
readonly screen?: 'all' | 'main' | number; | ||
The screen to get the wallpaper from. Values: `all` `main` or the index of a screen from `.screens()`. | ||
/** | ||
* **macOS only.** | ||
* | ||
* Scaling method. Values: `auto` `fill` `fit` `stretch` `center`. | ||
* | ||
* @default 'auto' | ||
*/ | ||
readonly scale?: 'auto' | 'fill' | 'fit' | 'stretch' | 'center'; | ||
@default 'main' | ||
*/ | ||
readonly screen?: 'all' | 'main' | number; | ||
} | ||
interface SetOptions { | ||
/** | ||
__macOS only.__ | ||
The screen to set the wallpaper on. Values: `all` `main` or the index of a screen from `.screens()`. | ||
*On Linux and Windows it's hard-coded to `main`.* | ||
@default 'all' | ||
*/ | ||
readonly screen?: 'all' | 'main' | number; | ||
/** | ||
__macOS only.__ | ||
Scaling method. Values: `auto` `fill` `fit` `stretch` `center`. | ||
@default 'auto' | ||
*/ | ||
readonly scale?: 'auto' | 'fill' | 'fit' | 'stretch' | 'center'; | ||
} | ||
} | ||
@@ -36,32 +38,57 @@ | ||
/** | ||
* Get the path to the wallpaper image currently set. | ||
* | ||
* @returns The path of the current desktop wallpaper. | ||
*/ | ||
get(options?: GetOptions): Promise<string>; | ||
Get the path to the wallpaper image currently set. | ||
@returns The path of the current desktop wallpaper. | ||
@example | ||
``` | ||
import wallpaper = require('wallpaper'); | ||
(async () => { | ||
await wallpaper.get(); | ||
//=> '/Users/sindresorhus/unicorn.jpg' | ||
})(); | ||
``` | ||
*/ | ||
get(options?: wallpaper.GetOptions): Promise<string>; | ||
/** | ||
* Set a new wallpaper. | ||
* | ||
* @param imagePath - The path to the image to set as the desktop wallpaper. | ||
*/ | ||
set(imagePath: string, options?: SetOptions): Promise<void>; | ||
Set a new wallpaper. | ||
@param imagePath - The path to the image to set as the desktop wallpaper. | ||
@example | ||
``` | ||
import wallpaper = require('wallpaper'); | ||
(async () => { | ||
await wallpaper.set('unicorn.jpg'); | ||
})(); | ||
``` | ||
*/ | ||
set(imagePath: string, options?: wallpaper.SetOptions): Promise<void>; | ||
/** | ||
* **macOS only.** | ||
* | ||
* @returns The available screens. | ||
* | ||
* @example | ||
* | ||
* import wallpaper from 'wallpaper'l | ||
* | ||
* (async () => { | ||
* await wallpaper.screens(); | ||
* //=> ['Color LCD'] | ||
* })(); | ||
*/ | ||
__macOS only.__ | ||
@returns The available screens. | ||
@example | ||
``` | ||
import wallpaper from 'wallpaper'; | ||
(async () => { | ||
await wallpaper.screens(); | ||
//=> ['Color LCD'] | ||
})(); | ||
``` | ||
*/ | ||
screens?(): Promise<string[]>; | ||
// TODO: remove this in the next major version | ||
// when removed, each of the methods in this interface can be refactored to an explicit function export | ||
// and `wallpaper` namespace may be removed completely along with the `export = wallpaper` export. | ||
default: typeof wallpaper; | ||
}; | ||
export default wallpaper; | ||
export = wallpaper; |
@@ -13,2 +13,3 @@ 'use strict'; | ||
module.exports = wallpaper; | ||
// TODO: remove this in the next major version | ||
module.exports.default = wallpaper; |
{ | ||
"name": "wallpaper", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "Manage the desktop wallpaper", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -36,6 +36,6 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"tsd-check": "^0.3.0", | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11450423
412