This library includes several example implementations demonstrating different ways to use the NMEA Web Serial library. Each example is available in the GitHub repository.
Live Demo: View Example
Source Code: examples/client-vanilla
A vanilla HTML/TypeScript example using the Client API. This demonstrates the simplest way to use the library without directly working with XState machines.
Key features:
NavigationNmeaClient class to create a client instance with callbacksonData, onStateChange, onError)Live Demo: View Example
Source Code: examples/xstate-react
A React example using XState to demonstrate how to use the NMEA Web Serial library with React hooks.
Key features:
createNavigationNmeaMachine() to create an XState machineuseMachine hook from @xstate/react for reactive state management when using XState with React.Live Demo: View Example
Source Code: examples/xstate-vanilla
A vanilla HTML/TypeScript example using XState to demonstrate how to use the NMEA Web Serial library without React.
Key features:
createNavigationNmeaMachine() to create an XState machinecreateActor from XState to create an actor instance from the machine.