@cmstops/unisdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/sdk.js +1 -0
  2. package/package.json +28 -0
package/lib/sdk.js ADDED
@@ -0,0 +1 @@
1
+ var CmstopUniSdk=function(){function i(){this.c={debug:!1,jsApiList:[]},this.state=0;try{this.plugin=uni.requireNativePlugin("UniSdkModule"),this.state=1}catch(i){this.state=3,uni.showToast({title:"挂载失败",duration:1500})}}return i.prototype.config=function(i){try{if(this.c=i,3===this.state)return void this.log("CmsTopSdk init error","error");this.state=2,this.log("CmsTopSdk initialized Susscess")}catch(i){this.log("CmsTopSdk initialized failed","error")}},i.prototype.invoke=function(i,t,o){var e,s,n,l=this;if(2!==this.state)return null===(e=null==o?void 0:o.fail)||void 0===e||e.call(o,"sdk not config succes~"),void this.log("CmsTopSdk initialized","error");try{this.plugin.asyncFunc({key:i,params:t},(function(t){var e,s,n,c;t.code?(0===t.code?null===(s=null==o?void 0:o.success)||void 0===s||s.call(o,t.data||"Method ".concat(i," exec success")):0!==t.code&&(null===(n=null==o?void 0:o.fail)||void 0===n||n.call(o,t.message||"Method ".concat(i," exec fail with no reason"))),null===(c=null==o?void 0:o.complete)||void 0===c||c.call(o,t),l.log("CmsTopSdk getMessage")):null===(e=null==o?void 0:o.success)||void 0===e||e.call(o,t)}))}catch(i){null===(s=null==o?void 0:o.fail)||void 0===s||s.call(o,i.message),null===(n=null==o?void 0:o.complete)||void 0===n||n.call(o,i.message),this.log("CmsTopSdk initialized","error")}},i.prototype.log=function(i,t){var o;void 0===t&&(t="info"),(null===(o=this.c)||void 0===o?void 0:o.debug)&&uni.showModal({title:t,content:i})},i}();["getUserInfo","getSiteInfo","getSystemResource","login","pushContent","pushMpHome","pushMpUser","pushTaskCenter","pushUserAgreement","pushPrivacyNotice","pushCategoryList","pushBuildinApp","pushWXMiniApp","getLocationInfo","openRecordAudio","updateUser","share"].forEach((function(i){CmstopUniSdk.prototype[i]=function(t,o){this.invoke(i,t,o)}})),globalThis.cmstopSdk=new CmstopUniSdk;
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@cmstops/unisdk",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "private": false,
7
+ "version": "1.0.0",
8
+ "description": "CmsTop Uni-App SDK",
9
+ "main": "./lib/sdk.js",
10
+ "files": [
11
+ "lib/sdk.js"
12
+ ],
13
+ "scripts": {
14
+ "test": "echo \"Error: no test specified\" && exit 1",
15
+ "build:sdk": "tsc ./sdk.ts --target ES5 --outDir ./static && npm run terser:sdk",
16
+ "terser:sdk": "terser ./static/sdk.js --compress --mangle --output ./static/sdk.js",
17
+ "build:sdk:publish": "tsc ./sdk.ts --target ES5 --outDir ./lib",
18
+ "terser:sdk:publish": "terser ./lib/sdk.js --compress --mangle --output ./lib/sdk.js",
19
+ "prepublishOnly": "npm run build:sdk:publish && npm run terser:sdk:publish"
20
+ },
21
+ "keywords": ["sdk", "uni-app", "cmstop"],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "devDependencies": {
25
+ "typescript": "^5.8.2",
26
+ "terser": "^5.39.0"
27
+ }
28
+ }