import { Meta, Props, Preview, Story } from '@storybook/addon-docs/blocks';
import * as Stories from './Linking.stories.js';

<Meta title="APIs|Linking" />

# Linking

Linking gives you a general interface for securely opening external URLs from JavaScript.

## Methods

### canOpenURL(url)

Returns a `Promise` that resolves to a boolean indicating whether the app can open the URL.

### getInitialURL()

Returns a `Promise` that resolves to the string of the URL that initially loaded the app.

### openURL(url)

Try to open the given url in a secure fashion. The method returns a `Promise`
object. If the url opens, the promise is resolved. If not, the promise is
rejected.

## Example

<Preview withSource='none'>
  <Story name="openURL">
    <Stories.openURL />
  </Story>
</Preview>
