UNPKG

1.05 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/**
9 * A pending copy-to-clipboard operation.
10 *
11 * The implementation of copying text to the clipboard modifies the DOM and
12 * forces a relayout. This relayout can take too long if the string is large,
13 * causing the execCommand('copy') to happen too long after the user clicked.
14 * This results in the browser refusing to copy. This object lets the
15 * relayout happen in a separate tick from copying by providing a copy function
16 * that can be called later.
17 *
18 * Destroy must be called when no longer in use, regardless of whether `copy` is
19 * called.
20 */
21export declare class PendingCopy {
22 private readonly _document;
23 private _textarea;
24 constructor(text: string, _document: Document);
25 /** Finishes copying the text. */
26 copy(): boolean;
27 /** Cleans up DOM changes used to perform the copy operation. */
28 destroy(): void;
29}