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

incu-webview

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

incu-webview

iNCU Webview 库,用于实现一些与原生端的交互操作。

  • 1.0.12
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

iNCU-Webview操作库

安装

版本一定要用@latest,确保每次构建都能拿到最新版

npm i incu-webview@latest --save

引用

ES6:

import Miracle from 'incu-webview'

浏览器:

<script src="node_modules/incu-webview/miracle.min.js"></script>
<script>
  console.log(window.Miracle)
</script>

调试

  1. 首先,在 云家园 的 iNCU 板块的toolbox中,加入你的项目。(只有管理员可以)
  2. 下载 iNCU 测试版
  3. 在校园生活中,进入网页,安卓/iOS 均使用数据线连接到电脑
  4. Android: 使用 chrome://inspect 调试
  5. iOS:使用 safari 调试,看第二步和第四步就行,教程:http://www.saitjr.com/ios/ios-user-safari-debug-webview.html
  6. incu-webview 在全局的变量是 Miracle

板块:

API

isApp

Demo:

import Miracle from 'incu-webview'

const isApp = Miracle.isApp()
console.log(isApp)

onAppReady

用于监听App的加载,加载完成后会调用回调。
除 isApp 外,其他所有Api需在AppReady后才能调用

参数与类型

onAppReady: (callback?: Function) => void

Demo:

import Miracle from 'incu-webview'

const onAppReady = Miracle.onAppReady(() => {
  console.log(Miracle.getData())
})

getData

获取App端的数据,具体格式,看数据吧……,请灵活使用该方法 =。=

Demo:

import Miracle from 'incu-webview'

console.log(Miracle.getData())

call

安全起见,具体能调用的方法查看 iNCU 的文档

参数与类型:

call: (
  baseClass: string,
  method: string,
  params: any,
  success?: Function,
  fail?: Function
) => void

Demo:

import Miracle from 'incu-webview'

Miracle.call('router', 'refresh', {
  title: 'Hello World'
}, () => {
  console.log('set Title success')
}, () => {
  console.log('set Title failed')
})

FAQs

Package last updated on 05 Aug 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc