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

universal-clipboard

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-clipboard - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.0-beta.3

build.json

5

lib/index.d.ts

@@ -1,2 +0,3 @@

declare let clipboard: any;
export default clipboard;
import { Clipboard } from './types';
declare let Clipboard: Clipboard;
export default Clipboard;

32

lib/index.js

@@ -8,13 +8,31 @@ "use strict";

var clipboard;
var _web = _interopRequireDefault(require("./web"));
var _weex = _interopRequireDefault(require("./weex"));
var _ali = _interopRequireDefault(require("./miniapp/ali"));
var _wechat = _interopRequireDefault(require("./miniapp/wechat"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Clipboard;
if (_universalEnv.isWeb) {
Clipboard = _web.default;
}
if (_universalEnv.isWeex) {
clipboard = require('./weex').default;
} else if (_universalEnv.isMiniApp) {
clipboard = require('./miniapp').default;
} else {
clipboard = require('./web').default;
Clipboard = _weex.default;
}
var _default = clipboard;
if (_universalEnv.isMiniApp) {
Clipboard = _ali.default;
}
if (_universalEnv.isWeChatMiniprogram) {
Clipboard = _wechat.default;
}
var _default = Clipboard;
exports.default = _default;

@@ -20,3 +20,3 @@ "use strict";

var removeInput = function removeInput() {
var removeInput = function () {
document.body.removeChild(input);

@@ -23,0 +23,0 @@ };

@@ -5,3 +5,8 @@ "use strict";

exports.default = void 0;
var clipboardModule = weex.requireModule('clipboard');
var weexModule;
function getClipboard() {
return weexModule = weexModule || __weex_require__('@weex-module/clipboard');
}
var clipboard = {

@@ -11,3 +16,3 @@ readText: function readText() {

try {
clipboardModule.getString(function (ret) {
getClipboard().getString(function (ret) {
resolve(ret.data);

@@ -23,3 +28,3 @@ });

try {
clipboardModule.setString(text);
getClipboard().setString(text);
resolve(text);

@@ -26,0 +31,0 @@ } catch (error) {

{
"name": "universal-clipboard",
"author": "rax",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"license": "BSD-3-Clause",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"miniappConfig": {
"main": "lib/miniapp/index"
},
"scripts": {
"start": "rax-scripts start --type 'component' -p 8000",
"start:miniapp": "rax-scripts start --type 'component-miniapp'",
"build": "rax-scripts build --type 'component'",
"test": "rax-scripts test",
"start": "rax-scripts start",
"build": "rax-scripts build",
"lint": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx ./src",
"prebuild": "npm run lint && npm run test",
"prebuild": "npm run lint",
"prepublish": "npm run build"

@@ -28,3 +23,3 @@ },

"driver-weex": "^1.0.0",
"universal-env": "^1.0.1"
"universal-env": "^2.0.0"
},

@@ -43,3 +38,4 @@ "devDependencies": {

"rax": "^1.0.4",
"rax-scripts": "1.2.1-beta.2",
"rax-plugin-component": "^0.1.8",
"rax-scripts": "^2.0.0",
"typescript": "^3.4.5"

@@ -46,0 +42,0 @@ },

@@ -1,13 +0,26 @@

import { isWeex, isMiniApp } from 'universal-env';
import { isWeb, isWeex, isMiniApp, isWeChatMiniprogram } from 'universal-env';
import webModule from './web';
import weexModule from './weex';
import miniAppModule from './miniapp/ali';
import weChatModule from './miniapp/wechat';
import { Clipboard } from './types';
let clipboard: any;
let Clipboard: Clipboard;
if (isWeb) {
Clipboard = webModule;
}
if (isWeex) {
clipboard = require('./weex').default;
} else if (isMiniApp) {
clipboard = require('./miniapp').default;
} else {
clipboard = require('./web').default;
Clipboard = weexModule;
}
export default clipboard;
if (isMiniApp) {
Clipboard = miniAppModule;
}
if (isWeChatMiniprogram) {
Clipboard = weChatModule;
}
export default Clipboard;

@@ -1,4 +0,9 @@

declare const weex: any;
// eslint-disable-next-line
declare const __weex_require__: any;
const clipboardModule = weex.requireModule('clipboard');
let weexModule: any;
function getClipboard() {
return weexModule = weexModule || __weex_require__('@weex-module/clipboard');
}
const clipboard: any = {

@@ -8,3 +13,3 @@ readText(): Promise<string> {

try {
clipboardModule.getString((ret): void => {
getClipboard().getString((ret): void => {
resolve(ret.data);

@@ -20,3 +25,3 @@ });

try {
clipboardModule.setString(text);
getClipboard().setString(text);
resolve(text);

@@ -23,0 +28,0 @@ } catch (error) {

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