Socket
Socket
Sign inDemoInstall

@w6s/codash

Package Overview
Dependencies
4
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @w6s/codash

A Cordova utility library.


Version published
Weekly downloads
2
increased by100%
Maintainers
2
Install size
138 kB
Created
Weekly downloads
 

Readme

Source

Codash npm

  • 可配置,易用,轻松实现cordova promisify;
  • 可添加拦截器,处理流程更方便;
  • 接口可模拟,无需写两套同名方法;
  • 提供常用方法,如绑定物理返回按钮,文件上传下载等。

使用 WorkPlus 扫一扫,查看在线 demo.

demo-link

WorkPlus Cordova API 官方说明文档

Docs

Install

npm install @w6s/codash --save 

Usage

import { Cordova, deviceReady } from '@w6s/codash';

// 实例化,相关可用配置属性,请查看文档
const wp = new Cordova();

// 设置拦截器
wp.interceptors.before.use((config) => {
  return config;
}, err => console.log(err));
wp.interceptors.after.use((response) => {
  return response;
}, err => console.log(err));

// 创建promisify的cordova方法
const authHook = wp.addHook('WorkPlus_Auth');
const getUserTicket = authHook.create('getUserTicket');

const getAccessToken = wp.create('WorkPlus_Auth', 'getAccessToken');

// deviceReady 同样可以配置,具体请查看文档
deviceReady({ mock: false })
  .then(() => Promise.all([getUserTicket(), getAccessToken()]))
  .then((res) => {})
  .catch((err) => {});

Contributors

Keywords

FAQs

Last updated on 13 May 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc