
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@w6s/cordova-import
Advanced tools
cordova-import.js
提供在 WorkPlus WebView 中注入 cordova 的能力,默认以local
的方式注入,但同时会根据不同的环境,例如轻应用的访问协议(http、https),是否在 iframe 内打开等,自动选择最佳的注入方式,开发者无需关注过多的注入细节,开箱即用,一步到位!
请确保脚本cordova-import.js
与ios.cordova.min.js
及android.cordova.min.js
放置到同一个资源目录,以确保脚本的正确加载。并且,为了提高资源的下载速度,请配置相关服务端的资源压缩策略,例如开启gzip
。
相关脚本可在Release页面进行下载。
单页面应用(SPA)引入一次即可,多页面应用还需在每个页面都单独引入
简单地在index.html
头部引入即可:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 直接添加即可 -->
<script src="//workplus.io/cordova-import.js" type="text/javascript"></script>
<title>Cordova Import Demo</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
yarn add @w6s/cordova-import
# or
npm install @w6s/cordova-import -S
尽可能在应用入口引入并初始化,以确保尽可能早地注入 CordovaJs
import CordovaImport from '@w6s/cordova-import';
CordovaImport.init('//workplus.io/'); // URI 无需带上访问协议,必须以斜杠结尾
当前仅支持传入 js 加载地址(非必须),默认使用local
模式,以加速开发效率!
若不传入地址,将完全使用
local
模式,请根据实际情况进行选择
const config = {
// 只有作为es模块初始化时,才需配置
SDK_HOST: null,
...
// 不同平台的 CordovaJs
cordovajs: {
iOS: 'ios.cordova.min.js',
android: 'android.cordova.min.js',
local: 'applocal://cordova.min.js',
},
...
};
FAQs
Automatic CordovaJs import util.
The npm package @w6s/cordova-import receives a total of 2 weekly downloads. As such, @w6s/cordova-import popularity was classified as not popular.
We found that @w6s/cordova-import demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.