universal-clipboard
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-beta.3
@@ -1,2 +0,3 @@ | ||
declare let clipboard: any; | ||
export default clipboard; | ||
import { Clipboard } from './types'; | ||
declare let Clipboard: Clipboard; | ||
export default Clipboard; |
@@ -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) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15241
14
27
424
1
+ Addeduniversal-env@2.0.0(transitive)
- Removeduniversal-env@1.0.7(transitive)
Updateduniversal-env@^2.0.0