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

@ued2345/octopus-util

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ued2345/octopus-util - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

2

dist/octopus.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.octopus=t():e.octopus=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";t.__esModule=!0,t.default=function(){var e=navigator.userAgent;return{trident:e.indexOf("Trident")>-1,presto:e.indexOf("Presto")>-1,webKit:e.indexOf("AppleWebKit")>-1,gecko:e.indexOf("Gecko")>-1&&-1===e.indexOf("KHTML"),mobile:!!e.match(/AppleWebKit.*Mobile.*/)||e.indexOf("Mobile")>-1,ios:!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:e.indexOf("Android")>-1||e.indexOf("Linux")>-1,iPhone:e.indexOf("iPhone")>-1,iPad:e.indexOf("iPad")>-1,webApp:-1===e.indexOf("Safari"),weixin:e.indexOf("MicroMessenger")>-1,qq:null!==e.match(/\sQQ/i),wpApp:e.indexOf("WangPaiMobile")>-1}}},function(e,t,n){"use strict";var i={},r=n(2);r.keys().forEach((function(e){var t=e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."));i[t]=r(e).default})),e.exports=i},function(e,t,n){var i={"./device/getBrowser.ts":0,"./jsbrige/jsBridge.ts":3};function r(e){var t=o(e);return n(t)}function o(e){if(!n.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}r.keys=function(){return Object.keys(i)},r.resolve=o,e.exports=r,r.id=2},function(e,t,n){"use strict";var i,r=(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0;var o=new(function(e){function t(){return e.call(this)||this}return r(t,e),t.prototype.callHandler=function(t,n){e.prototype.init.call(this,(function(e){e.callHandler("jsCallJavaAllInOne",t,n)}))},t.prototype.registerHandler=function(t,n){e.prototype.init.call(this,(function(e){e.registerHandler(t,n)}))},t}(n(4).default));o.first(),t.default={callHandler:o.callHandler,registerHandler:o.registerHandler}},function(e,t,n){"use strict";t.__esModule=!0;var i=n(0).default(),r=function(){function e(){this.isIOS=i.ios}return e.prototype.init=function(e){if(this.isIOS){if(window.WebViewJavascriptBridge)return e(window.WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var t=document.createElement("iframe");t.style.display="none",t.src="wvjbscheme://__BRIDGE_LOADED__",document.documentElement.appendChild(t),setTimeout((function(){document.documentElement.removeChild(t)}),0)}else window.WebViewJavascriptBridge?e(window.WebViewJavascriptBridge):document.addEventListener("WebViewJavascriptBridgeReady",(function(){e(window.WebViewJavascriptBridge)}),!1)},e.prototype.first=function(){this.isIOS||this.init((function(e){e.init((function(e,t){t()}))}))},e}();t.default=r}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.octopus=t():e.octopus=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";t.__esModule=!0,t.default=function(){var e=navigator.userAgent;return{trident:e.indexOf("Trident")>-1,presto:e.indexOf("Presto")>-1,webKit:e.indexOf("AppleWebKit")>-1,gecko:e.indexOf("Gecko")>-1&&-1===e.indexOf("KHTML"),mobile:!!e.match(/AppleWebKit.*Mobile.*/)||e.indexOf("Mobile")>-1,ios:!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:e.indexOf("Android")>-1||e.indexOf("Linux")>-1,iPhone:e.indexOf("iPhone")>-1,iPad:e.indexOf("iPad")>-1,webApp:-1===e.indexOf("Safari"),weixin:e.indexOf("MicroMessenger")>-1,qq:null!==e.match(/\sQQ/i),wpApp:e.indexOf("WangPaiMobile")>-1}}},function(e,t,n){"use strict";t.__esModule=!0;var i=n(0),r=n(2);t.default={getBrowser:i.default,jsBridge:r.default}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0;var o=new(function(e){function t(){return e.call(this)||this}return r(t,e),t.prototype.callHandler=function(t,n){e.prototype.init.call(this,(function(e){e.callHandler("jsCallJavaAllInOne",t,n)}))},t.prototype.registerHandler=function(t,n){e.prototype.init.call(this,(function(e){e.registerHandler(t,n)}))},t}(n(3).default));o.first(),t.default={callHandler:o.callHandler,registerHandler:o.registerHandler}},function(e,t,n){"use strict";t.__esModule=!0;var i=n(0).default(),r=function(){function e(){this.isIOS=i.ios}return e.prototype.init=function(e){if(this.isIOS){if(window.WebViewJavascriptBridge)return e(window.WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var t=document.createElement("iframe");t.style.display="none",t.src="wvjbscheme://__BRIDGE_LOADED__",document.documentElement.appendChild(t),setTimeout((function(){document.documentElement.removeChild(t)}),0)}else window.WebViewJavascriptBridge?e(window.WebViewJavascriptBridge):document.addEventListener("WebViewJavascriptBridgeReady",(function(){e(window.WebViewJavascriptBridge)}),!1)},e.prototype.first=function(){this.isIOS||this.init((function(e){e.init((function(e,t){t()}))}))},e}();t.default=r}])}));
{
"name": "@ued2345/octopus-util",
"version": "1.0.7",
"version": "1.0.8",
"description": "ued2345 utils",

@@ -5,0 +5,0 @@ "main": "dist/octopus.min.js",

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

### 一、技术选型
### 技术选型
* typescript

@@ -6,3 +6,3 @@ * babel

### 二、 项目结构介绍
### 项目结构介绍
``` bash

@@ -18,4 +18,4 @@ ├── build

│ ├── jsbrige
│ │ │── init // 二级目录(放ts文件不会暴露)
│ │ │ │── bridge.js // 定义类型
│ │ │── init // 二级目录
│ │ │ │── bridge.ts // 定义类型
│ │ │ └── brigeInit.ts // 创建bridge对象

@@ -30,9 +30,4 @@ │ │ └── jsBrige.ts // export jsbridge方法

```
### 三、开发步骤
1. 看webpack打包入口文件index.ts。
2. octopus.d.ts添加方法格式。
3. src目录创建放方法的文件夹。
4. 文件夹里编写methodName.ts方法。
### 四、构建与部署
### 构建与部署
```

@@ -42,3 +37,3 @@ 第一步:npm run build

```
### 五、API文档
### API文档
``` javascript

@@ -71,21 +66,14 @@ octopus = {

```
### 六、安装使用
UMD的实现:
1. 先判断是否支持Node.js模块格式(exports是否存在),存在则使用Node.js模块格式。
2. 再判断是否支持AMD(define是否存在),存在则使用AMD方式加载模块。
3. 前两个都不存在,则将模块公开到全局(window或global)。
#### 浏览器
```html
<script src="octopus.min.js"></script>
<script>
var octopus = octopus.getBrowser()
</script>
### 安装使用
```
#### npm
npm install --save-dev @ued2345/octopus
```
npm install --save-dev @ued2345/octopus
// webpack中使用
const octopus = require('@ued2345/octopus')
#### 项目中调用
```javascript
import octopus from '@ued2345/octopus'
const browser = octopus.getBrowser()
// 或单独引用方法
import {getBrowser} from '@ued2345/octopus'
```

@@ -92,0 +80,0 @@

/**
* webpack打包入口
*/
interface RequireContext {
keys(): string[];
(id: string): any;
}
import getBrowser from "./device/getBrowser";
import jsBridge from "./jsbrige/jsBridge";
/**
* 导出的方法集合
*/
let exportModules: object = {};
/**
* 遍历src第一级目录中的methodName.ts文件
*/
const r: RequireContext = require.context('./', true, /^\.\/[^\/]+\/[^\/]+\.ts$/);
/**
* 截取././methodName.ts => exportModules[methodName]
*/
r.keys().forEach(key => {
let attr = key.substring(key.lastIndexOf('/') + 1, key.lastIndexOf('.'));
exportModules[attr] = r(key).default;
});
module.exports = exportModules;
export default {
getBrowser,
jsBridge,
};

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