Sample Code
We aim to provide consistent, clean and idiomatic sample code for the most popular frontend frameworks. If you have feedback regarding our sample code (we are by no means expert in every framework!), feel free to send us your comments to hello@pixelverse.ch or open a pull request in the Github repository.
Structure of Sample App
Most of our code samples show the following three usage scenarios:
Single Scan – Scan a single barcode and return to the previous screen. Illustrates basic SDK usage such as SDK and BarcodeReader initialization and lifecycle management.
Repeated Scans – Scan barcodes repeatedly with an intermediate user action between scans until an application-specific criterion is met. Illustrates using start()
and stop()
to control the BarcodeReader
,
Continuous Scans - Scan barcodes continuously until an application-specific criterion is met (e.g. all N barcodes on a label are scanned).
Code Samples by Framework
- Vanilla JS
An example of how to use STRICH without any web framework at all, using just plain ES6. Github repository
- Angular
Sample integration into an Angular web app. Uses standalone components. Github repository
- SvelteKit
Sample integration into a SvelteKit web app. Uses SvelteKit 2.x. Github repository
- React
Sample code showing how to integrate STRICH into a React project. Uses React functional components (React 16.8+). Github repository
- Vue 3
Sample code showing how to integrate STRICH into a Vue 3.x project. Github repository
- iOS (Swift/Swift UI)
Sample code for integrating a web app that uses STRICH into a native iOS app using a WebView. Github repository
- Vaadin Flow (WIP)
Sample code showing how to integrate STRICH into a Vaadin Flow project. Github repository
- Vue 2 (deprecated)
Sample code showing how to integrate STRICH into a Vue 2.x project. This sample is no longer maintained. Github repository
Contributing
Are you interested in contributing to our samples or even providing a sample of your own that we can link to? Drop us a line at hello@pixelverse.ch. Here's what we value in submissions:
- Clean
Sample code should not contain extra files or dependencies that are not required to run the sample or dilute the sample's purpose.
- Minimal
Sample code should not contain business logic or styling and focus solely on idiomatic integration into the target environment.
- Self-contained
Sample code should not require extra dependencies apart from the target environment itself, e.g. an Angular sample should depend only on Angular, and not on additional libraries such as Angular Material.
- Documented
A short README containing a description of the sample and pointing out the salient bits is a must, as well as specifying a license for the code.
Licensing
Sample code is provided as-is under the CC0 license. The code is for illustrative purposes only and may not be suitable for production.
External Contributions
- Blazor
Sample code showing how to integrate STRICH into a Blazor project. Github repository
Contributed by: Shaokang Wang and Pierre Mertz, Infinera