npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mega-sdks/native-js

v1.1.2

Published

MEGA NativeJS for Android, Electron ...

Downloads

39

Readme

@mega-sdks/native-js

特性

  • [ ] 支持选取图片
    • [x] Android
    • [x] Electron
  • [ ] 支持扫描二维码、条形码
    • [x] Android
    • [ ] Electron
  • [ ] 支持拍照、选取照片
    • [x] Android
    • [ ] Electron
  • [ ] 支持USB通讯
    • [ ] Android
    • [ ] Electron
  • [ ] 支持有Native层建立的WebSocket通讯
    • [x] Android
    • [x] Electron
  • [ ] 支持显示通知信息
    • [x] Android
    • [x] Electron
  • [ ] 支持VNC连接
    • [ ] Android
    • [ ] Electron
  • [ ] 支持HDMI信号源接入播放视频
    • [ ] Android
    • [ ] Electron
  • [ ] 支持获取App信息(网络状态信息,Mac地址,设备信息,状态信息,软件版本,软件信息)
    • [x] Android
    • [x] Electron
  • [ ] 支持自动更新
    • [ ] Android
    • [ ] Electron

安装

npm i @mega-sdks/native-js

使用

// 在需要的项目中引入 

  import { NativeShell } from '@mega-sdks/native-js'

  //如下示例
  mounted () {
    // 获取Mac地址回调 this后面的方法为你自己定义的方法
    NativeShell.getMacAddress = this.getMacAddress 
    // 获取IP地址回调
    NativeShell.getIpAddress = this.getIpAddress
    // Mac地址 和 IP地址获取
    // 发送获取Mac 和 IP的方法
    NativeShell.sendPost()

    // 显示通知信息
    // @parm {Object} data  e.g  { contentTitle:'这是标题', contentText:'这是内容' }
    NativeShell.showNotification({
      contentTitle:'这是标题', 
      contentText:'这是内容'
    })

    // WebSocket通讯

    // 连接WebSocket @param {String} url 必传
    NativeShell.connect({ url:'' })
    
    // 回调方法 以下this后面的方法均为你自己定义的方法
    NativeShell.onOpenSocketCallback = this.onOpenSocketCallback // 连接成功

    NativeShell.onMessageSocketCallback = this.onMessageSocketCallback // 消息返回

    NativeShell.onCloseSocketCallback = this.onCloseSocketCallback // 关闭WebSocket

    NativeShell.onErrorSocketCallback = this.onErrorSocketCallback // 连接WebSocket错误
  },
  methods: {
    getMacAddress (result) {
      //mac 地址
      this.macAddRess = result.data.macAddress.mac
    },
    getIpAddress (result) {
      //ip 地址
      this.ipAddRess = result.data.macAddress.ipv4
    },
    /*
    * 连接成功回调
    */
    onOpenSocketCallback(result){
      // 发送消息 @param {String} msg 必传
      NativeShell.sendMessage("test") 
    },
    /*
    * 消息返回回调
    */
    onMessageSocketCallback(result){
      console.log(`====> message result:${result}`)
    },
    /*
    * 关闭WebSocket回调
    */
    onCloseSocketCallback(result){
      console.log(`====> close result:${result}`)
    },
    /*
    * WebSocket错误回调
    */
    onErrorSocketCallback(result){
      // 关闭WebSocket
      NativeShell.closeSocket() 
      console.log(`====> error result:${result}`)
    }
  }
  

路线

  • [ ] 支持获取Mac地址
  • [ ] 支持有Native层建立的WebSocket通讯

License

MIT