0.7.7 • Published 2 months ago

srf-native-bridge v0.7.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

SRF Native Bridge

Integrate the bridge in a web view

  • Run npm install --save srf-native-bridge
  • If you need to support SRF apps that still use the old version of the native bridge, include the following code directly in your HTML file. This code should not be loaded later, because old apps need to be able to execute these functions immediately after loading.
<script>
  function fetchMetaData() {
    window.legacyAppReady = true;
  }

  function setAutoplayEnabled(autoplay) {
    window.legacyAutoplayEnabled = autoplay;
  }

  function setDeviceInfo(data) {
    window.legacyDeviceInfo = data;
  }
</script>
  • Initialize the bridge with the metadata of the page:
import { SRFBridge } from 'srf-native-bridge';

SRFBridge.init({
  title: 'Your Page Title',
  weburl: 'https://www.srf.ch/sport',
  subscriptionLists: ['sport_subscription_list'],
});

After these steps, the bridge connection is established, and you can start to send and receive events using the public API, which is exported and documented in index.ts.

Setup dev environment

To start developing new features for the bridge, simply run:

Add a new event to the bridge

  • Add the new event with its payload to event-types.ts
  • (optional) If you want to provide a convenience function to the JavaScript users of the bridge, add it to the public API in index.ts
  • Release the package

Test

  • npx tsdx build; npx tsdx test will build and run all tests.
  • npx tsdx lint will run the linter

Release

To create new release do the following:

  • Merge all features you want to publish in the main branch
  • Run npm login (the SRF username and password can be found in Passbolt)
  • Run npm run release and follow the instructions

Note: We use np to publish this package to NPM.

Additional docs

0.7.7

2 months ago

0.7.5

6 months ago

0.7.4

6 months ago

0.7.3

7 months ago

0.7.2

8 months ago

0.7.1

8 months ago

0.6.3

1 year ago

0.6.2

1 year ago

0.7.0

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.2

2 years ago

0.3.1

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago