source: trip-planner-front/node_modules/@angular/cdk/esm2015/clipboard/clipboard.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.6 KB
Line 
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 */
8import { DOCUMENT } from '@angular/common';
9import { Inject, Injectable } from '@angular/core';
10import { PendingCopy } from './pending-copy';
11import * as i0 from "@angular/core";
12import * as i1 from "@angular/common";
13/**
14 * A service for copying text to the clipboard.
15 */
16export class Clipboard {
17 constructor(document) {
18 this._document = document;
19 }
20 /**
21 * Copies the provided text into the user's clipboard.
22 *
23 * @param text The string to copy.
24 * @returns Whether the operation was successful.
25 */
26 copy(text) {
27 const pendingCopy = this.beginCopy(text);
28 const successful = pendingCopy.copy();
29 pendingCopy.destroy();
30 return successful;
31 }
32 /**
33 * Prepares a string to be copied later. This is useful for large strings
34 * which take too long to successfully render and be copied in the same tick.
35 *
36 * The caller must call `destroy` on the returned `PendingCopy`.
37 *
38 * @param text The string to copy.
39 * @returns the pending copy operation.
40 */
41 beginCopy(text) {
42 return new PendingCopy(text, this._document);
43 }
44}
45Clipboard.ɵprov = i0.ɵɵdefineInjectable({ factory: function Clipboard_Factory() { return new Clipboard(i0.ɵɵinject(i1.DOCUMENT)); }, token: Clipboard, providedIn: "root" });
46Clipboard.decorators = [
47 { type: Injectable, args: [{ providedIn: 'root' },] }
48];
49Clipboard.ctorParameters = () => [
50 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
51];
52//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpcGJvYXJkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9jbGlwYm9hcmQvY2xpcGJvYXJkLnRzIl0sIm5hbWVzIjpbXSwibW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