-
-
Notifications
You must be signed in to change notification settings - Fork 748
Expand file tree
/
Copy pathClipboard.ts
More file actions
44 lines (39 loc) · 1.16 KB
/
Copy pathClipboard.ts
File metadata and controls
44 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* @since 1.0.0
*/
import type { PlatformError } from "@effect/platform/Error"
import type { Tag } from "effect/Context"
import type * as Effect from "effect/Effect"
import type * as Layer from "effect/Layer"
import * as internal from "./internal/clipboard.js"
/**
* @since 1.0.0
* @category interface
*/
export interface Clipboard {
readonly read: Effect.Effect<ClipboardItems, PlatformError>
readonly readString: Effect.Effect<string, PlatformError>
readonly write: (items: ClipboardItems) => Effect.Effect<void, PlatformError>
readonly writeString: (text: string) => Effect.Effect<void, PlatformError>
readonly writeBlob: (blob: Blob) => Effect.Effect<void, PlatformError>
readonly clear: Effect.Effect<void, PlatformError>
}
/**
* @since 1.0.0
* @category constructor
*/
export const make: (
impl: Omit<Clipboard, "clear" | "writeBlob">
) => Clipboard = internal.make
/**
* @since 1.0.0
* @category tag
*/
export const Clipboard: Tag<Clipboard, Clipboard> = internal.tag
/**
* A layer that directly interfaces with the navigator.clipboard api
*
* @since 1.0.0
* @category layers
*/
export const layer: Layer.Layer<Clipboard> = internal.layer