UNPKG

@tdb/util

Version:
25 lines 866 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var constants_1 = require("../../constants"); function copy(value) { return tslib_1.__awaiter(this, void 0, void 0, function () { var el; return tslib_1.__generator(this, function (_a) { if (constants_1.IS_BROWSER) { if (typeof value === 'object') { value = JSON.stringify(value, null, ' '); } el = document.createElement('textarea'); el.value = value; document.body.appendChild(el); el.select(); document.execCommand('copy'); document.body.removeChild(el); } return [2]; }); }); } exports.copy = copy; //# sourceMappingURL=clipboard.js.map