Code Monkey home page Code Monkey logo

open-app's Introduction

open-app

A component for opening imToken app from webpage.

Usage

install:

yarn add git+https://github.com/xwartz/open-app

or

<script src="https://cdn.whale.token.im/open-app/index.umd.js"></script>

Basic Usage:

import OpenApp from 'open-app'
const props = {}
const openApp = new OpenApp(props)

Parameters:

interface Props {
  schemeUrl?: string
  fallbackUrl?: string
  buttonStyle?: object
  buttonText?: string
  timeout?: number
}

Default Parameters:

const props = {
  schemeUrl: 'imtokenv2://navigate?screen=DappView',
  fallbackUrl: 'https://token.im/download',
  buttonStyle: buttonStyle,
  buttonText: isZh ? '打开 imToken' : 'Open imToken',
  timeout: 2000,
}

How it works

  1. Render the「打开 imToken」button.
  2. Render the「请使用浏览器打开」tip, and set it display to none.
  3. The component will try to open imToken app with URL Scheme if user clicks the「打开 imToken」button.
  4. Use a fallback url if failed to open app.

open-app's People

Contributors

dependabot[bot] avatar xwartz avatar zhaofz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

suntopo

open-app's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.