2.0.0-pre.0 • Published 3 years ago

@paypay/jsbridge v2.0.0-pre.0

Weekly downloads
59
License
MIT
Repository
github
Last release
3 years ago

Table of Contents

About The Project

This module contains ready to use JsBridge bundle, primary for 3rd party apps development.

Built With

Getting Started

This module contains a ready to use bundle, including all necessary modules.

Prerequisites

The only requirement is to have NPM or Yarn installed in the system.

Installation

To install package, simply use NPM:

npm install @paypay/jsbridge

Or Yarn

yarn add @paypay/jsbridge

Usage

Importing the module will automatically expose all necessary objects and instances to global window object. To access available methods either imported instance or global window reference can be used.

All exposed methods take optional callback parameters that can be used to handle results instead of using async/await syntax.

import jsBridge from '@paypay/jsbridge'

const result = await jsBridge.getSystemInfo()

// OR

jsBridge.getSystemInfo()
  .then((res) => {
    // Handle success
    console.log(res)
  })
  .catch((err) => {
    // Handle failure
    console.log(err)
  })
  .finally(() => {
    // HAndle complete
  })

// OR

jsBridge.getSystemInfo({
  success(res) {
    // Handle success
    console.log(res)
  },
  fail(err) {
    // Handle failure
    console.log(err)
  },
  complete() {
    // Handle complete
  }
})

This is equivalent to:

import '@paypay/jsbridge'

const result = await window.PayPayJsBridge.getSystemInfo()

API

API documentation, auto generated by Typedoc are available in docs folder.

The bundle exposes all methods defined in embedded modules:

Please refer to the modules documentation for more details for their APIs.

License

Distributed under the MIT License. See LICENSE for more information.