GithubHelp home page GithubHelp logo

awesome-landing's Introduction

awesome-landing

NPM version build status Test coverage npm download


How to use

open and download all in one

import commonLanding from 'awesome-landing'

// for open app
const urlScheme = 'appscheme://app.scheme'
const androidIntentScheme = 'intent://app.intent/#Intent;scheme=appscheme;package=app.package;action=app.action;end'

// for download app
const iosDownloadUrl = 'https://itunes.apple.com/us/app/appid'
const androidDownloadUrl = 'https://play.google.com/store/apps/details?id=app.id'
const androidPackageName = 'app.package.name'
const androidIntentDownloadScheme = 'intent://app.intent/#Intent;scheme=appScheme;end'

commonLanding({
  urlScheme,
  iosDownloadUrl,
  androidPackageName,
  androidIntentScheme,
  androidDownloadUrl,
  androidIntentDownloadScheme,
  forceIntent, // force Android to use intent
})

Theses params are optional:

  • androidIntentScheme
  • androidIntentDownLoadScheme
  • forceIntent

separate open and download

import {
  openApp,
  download,
} from 'awesome-landing'

// for open app
const urlScheme = 'appscheme://app.scheme'
const androidIntentScheme = 'intent://app.intent/#Intent;scheme=appscheme;package=app.package;action=app.action;end'

// for download app
const iosDownloadUrl = 'https://itunes.apple.com/us/app/appid'
const androidDownloadUrl = 'https://play.google.com/store/apps/details?id=app.id'
const androidPackageName = 'app.package.name'
const androidIntentDownloadScheme = 'intent://app.intent/#Intent;scheme=appScheme;end'

// openApp() returns a Promise
openApp({
  urlScheme,
  androidPackageName,
  androidIntentScheme,
}).then(res => {
  console.log('open app res:', res)
}).catch(e => {
  console.log('open app failed:', e)
})


download({
  iosDownloadUrl,
  androidDownloadUrl,
  androidIntentDownloadScheme,
})

How to debug

  • add query in url __landingDebug__=1

How to mock userAgent

window.sessionStorage.DEBUG_SCHEME_UA = YOUR_MOCK_UA_STRING

Contributors


yangmingshan


zhangyuheng


xudafeng

This project follows the git-contributor spec, auto upated at Thu Oct 18 2018 11:07:22 GMT+0800.

awesome-landing's People

Contributors

xudafeng avatar yangmingshan avatar zhangyuheng avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.