Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextui-org/use-clipboard

Package Overview
Dependencies
Maintainers
0
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextui-org/use-clipboard - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

38

dist/index.js

@@ -31,24 +31,30 @@ "use strict";

const [copyTimeout, setCopyTimeout] = (0, import_react.useState)(null);
const onClearTimeout = () => {
const onClearTimeout = (0, import_react.useCallback)(() => {
if (copyTimeout) {
clearTimeout(copyTimeout);
}
};
const handleCopyResult = (value) => {
onClearTimeout();
setCopyTimeout(setTimeout(() => setCopied(false), timeout));
setCopied(value);
};
const copy = (valueToCopy) => {
if ("clipboard" in navigator) {
navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch((err) => setError(err));
} else {
setError(new Error("useClipboard: navigator.clipboard is not supported"));
}
};
const reset = () => {
}, [copyTimeout]);
const handleCopyResult = (0, import_react.useCallback)(
(value) => {
onClearTimeout();
setCopyTimeout(setTimeout(() => setCopied(false), timeout));
setCopied(value);
},
[onClearTimeout, timeout]
);
const copy = (0, import_react.useCallback)(
(valueToCopy) => {
if ("clipboard" in navigator) {
navigator.clipboard.writeText(valueToCopy).then(() => handleCopyResult(true)).catch((err) => setError(err));
} else {
setError(new Error("useClipboard: navigator.clipboard is not supported"));
}
},
[handleCopyResult]
);
const reset = (0, import_react.useCallback)(() => {
setCopied(false);
setError(null);
onClearTimeout();
};
}, [onClearTimeout]);
return { copy, reset, error, copied };

@@ -55,0 +61,0 @@ }

{
"name": "@nextui-org/use-clipboard",
"version": "2.0.6",
"version": "2.0.7",
"description": "Wrapper around navigator.clipboard with feedback timeout",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc