react-native-metronome-module
TypeScript icon, indicating that this package has built-in type declarations

2.4.1 • Public • Published

react-native-metronome-module

Cross-platform metronome module for iOS and Android

Installation

npm install react-native-metronome-module

You must include a metronome.wav file in the following locations for this module to work:

  • android/app/src/main/res/raw
  • ios (and add the file to the project in XCode)

Usage

import MetronomeModule from "react-native-metronome-module";

// ...

MetronomeModule.setBPM(100);
MetronomeModule.setShouldPauseOnLostFocus(true);

MetronomeModule.start();

// ...

if (await MetronomeModule.isPlaying()) {
  const bpm = await MetronomeModule.getBPM();
  console.log(`Metronome playing at ${bpm}bpm!`);

  MetronomeModule.stop();
}

Methods

Control

start: () => void
stop: () => void

Getters/Setters

setBPM: (newBPM: number) => void
getBPM: () => Promise<number>


setShouldPauseOnLostFocus: (shouldPause: boolean) => void
getShouldPauseOnLostFocus: () => Promise<number>

Check State

isPlaying: () => Promise<boolean>
isPaused: () => Promise<boolean>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Package Sidebar

Install

npm i react-native-metronome-module

Weekly Downloads

3

Version

2.4.1

License

MIT

Unpacked Size

30.1 kB

Total Files

18

Last publish

Collaborators

  • jones.tristand