@ued2345/octopus-util
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -7,8 +7,8 @@ const path = require('path') | ||
const config = require('./webpack.config') | ||
const buildConfig = require('./config') | ||
const resolve = dir => path.join(__dirname, '..', dir) | ||
const pkgName = 'octopus' | ||
let building = ora('开始打包....') | ||
building.start() | ||
rm(resolve(`dist/${pkgName}.min.js`), err => { | ||
rm(resolve(`dist/${buildConfig.buildFileName}`), err => { | ||
if (err) throw err | ||
@@ -15,0 +15,0 @@ webpack(config, (err, stats) => { |
const webpack = require('webpack') | ||
const path = require('path') | ||
const pkgName = 'octopus' | ||
const buildConfig = require('./config') | ||
const resolve = dir => path.join(__dirname, '..', dir) | ||
@@ -9,5 +9,5 @@ const config = { | ||
output: { | ||
filename: `${pkgName}.min.js`, | ||
filename: buildConfig.buildFileName, | ||
path: resolve('dist'), | ||
library: `${pkgName}`, | ||
library: buildConfig.libName, | ||
libraryTarget: "umd" | ||
@@ -14,0 +14,0 @@ }, |
{ | ||
"name": "@ued2345/octopus-util", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "ued2345 utils", | ||
"main": "dist/octopus.min.js", | ||
"types": "octopus.d.ts", | ||
"main": "dist/octopus-util.min.js", | ||
"scripts": { | ||
@@ -8,0 +7,0 @@ "build": "node build/build.js" |
@@ -12,6 +12,11 @@ ### 技术选型 | ||
├── dist | ||
│ ├── octopus.min.js // 打包后的文件,也是被其它项目引入的文件 | ||
│ ├── octopus-util.min.js // 打包后的文件,也是被其它项目引入的文件 | ||
├── src | ||
│ ├── device | ||
│ │ │── getBrowser.ts // 获取操作系统类型 | ||
│ │ └── gettInApp.ts // 判断是否在APP内 | ||
│ ├── cookie | ||
│ │ │── getCookie.ts // 获取cookie | ||
│ │ │── setCookie.ts // 设置cookie | ||
│ │ └── delCookie.ts // 删除cookie | ||
│ ├── jsbrige | ||
@@ -52,4 +57,6 @@ │ │ │── init // 二级目录 | ||
weixin: boolean, | ||
wpApp: boolean, | ||
}, | ||
// 通过userAgent 判断是否在APP内 | ||
getInApp: (uName) => {return boolean}, | ||
// JsBridge 与原生通信 | ||
JsBridge: { | ||
@@ -60,3 +67,7 @@ // js调用webview事件 | ||
registerHandle: (method, callback) => {}, | ||
} | ||
}, | ||
// cookie 操作 | ||
setCookie: (name, value, days) => {}, | ||
getCookie: (name) => {}, | ||
delCookie: (name) => {} | ||
} | ||
@@ -72,5 +83,5 @@ ``` | ||
```html | ||
<script src="octopus.min.js"></script> | ||
<script src="octopus-util.min.js"></script> | ||
<script> | ||
var browser = octopus.getBrowser() | ||
var browser = window.OcUtil.getBrowser() | ||
</script> | ||
@@ -80,4 +91,4 @@ ``` | ||
```javascript | ||
import * as octopus from '@ued2345/octopus-util' | ||
const browser = octopus.getBrowser() | ||
import OcUtil from '@ued2345/octopus-util' | ||
const browser = OcUtil.getBrowser() | ||
@@ -84,0 +95,0 @@ // 或单独引用方法 |
@@ -16,5 +16,4 @@ function getBrowser(): any{ | ||
qq: u.match(/\sQQ/i) !== null, // 是否QQ | ||
wpApp: u.indexOf('WangPaiMobile') > -1 // 是否在王牌移动联盟APP内 | ||
} | ||
} | ||
export default getBrowser; |
@@ -5,7 +5,15 @@ /** | ||
import getBrowser from "./device/getBrowser"; | ||
import getInApp from "./device/getInApp"; | ||
import JsBridge from "./jsbrige/jsBridge"; | ||
import getCookie from "./cookie/getCookie"; | ||
import setCookie from "./cookie/setCookie"; | ||
import delCookie from "./cookie/delCookie"; | ||
export { | ||
module.exports.default = module.exports = { | ||
getBrowser, // 获取操作系统类型 | ||
getInApp, // 通过userAgent判断是否在app内 | ||
JsBridge, // jsBridge 对象 | ||
getCookie, | ||
setCookie, | ||
delCookie, | ||
}; |
{ | ||
"compilerOptions": { | ||
"module": "esnext", | ||
"target": "es5", | ||
"module": "commonjs", | ||
"noImplicitAny": false, | ||
@@ -6,0 +5,0 @@ "removeComments": true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
16083
18
288
100