@@ -29,31 +29,34 @@ Install the barcode-scanner plugin to get started.
2929<Tabs >
3030 <TabItem label = " Automatic" >
3131
32- Use your project's package manager to add the dependency:
32+ Use your project's package manager to add the dependency:
3333
34- <CommandTabs npm = " npm run tauri add barcode-scanner"
35- yarn = " yarn run tauri add barcode-scanner"
36- pnpm = " pnpm tauri add barcode-scanner"
37- cargo = " cargo tauri add barcode-scanner" />
34+ { ' ' }
35+ <CommandTabs
36+ npm = " npm run tauri add barcode-scanner"
37+ yarn = " yarn run tauri add barcode-scanner"
38+ pnpm = " pnpm tauri add barcode-scanner"
39+ cargo = " cargo tauri add barcode-scanner"
40+ />
3841
3942 </TabItem >
4043 <TabItem label = " Manual" >
4144
42- 1 . Run ` cargo add tauri-plugin-barcode-scanner ` to add the plugin to the project's dependencies in ` Cargo.toml ` .
45+ 1 . Run ` cargo add tauri-plugin-barcode-scanner ` to add the plugin to the project's dependencies in ` Cargo.toml ` .
4346
44- 2 . Modify ` lib.rs ` to initialize the plugin:
47+ 2 . Modify ` lib.rs ` to initialize the plugin:
4548
46- ``` rust title="lib.rs" ins={4}
47- #[cfg_attr(mobile, tauri:: mobile_entry_point)]
48- fn run () {
49- tauri :: Builder :: default ()
50- . plugin (tauri_plugin_barcode_scanner :: init ())
51- . run (tauri :: generate_context! ())
52- . expect (" error while running tauri application" );
53- }
54- ```
49+ ``` rust title="lib.rs" ins={4}
50+ #[cfg_attr(mobile, tauri:: mobile_entry_point)]
51+ fn run () {
52+ tauri :: Builder :: default ()
53+ . plugin (tauri_plugin_barcode_scanner :: init ())
54+ . run (tauri :: generate_context! ())
55+ . expect (" error while running tauri application" );
56+ }
57+ ```
5558
56- 3 . Install the JavaScript Guest bindings using your preferred JavaScript package manager:
59+ 3 . Install the JavaScript Guest bindings using your preferred JavaScript package manager:
5760
5861 <CommandTabs
5962 npm = " npm install @tauri-apps/plugin-barcode-scanner"
@@ -68,12 +71,12 @@ Install the barcode-scanner plugin to get started.
6871The barcode scanner plugin is available in JavaScript.
6972
7073``` js
71- import { scan , Format } from " @tauri-apps/plugin-barcode-scanner" ;
74+ import { scan , Format } from ' @tauri-apps/plugin-barcode-scanner' ;
7275
7376// `windowed: true` actually sets the webview to transparent
7477// instead of opening a separate view for the camera
7578// make sure your user interface is ready to show what is underneath with a transparent element
76- scan ({ windowed: true , formats: [Format .QRCode ] })
79+ scan ({ windowed: true , formats: [Format .QRCode ] });
7780```
7881
7982## Permissions
@@ -85,28 +88,25 @@ See [Access Control List](/references/v2/acl) for more information.
8588
8689``` json title="src-tauri/capabilities/mobile.json"
8790{
88- "$schema" : " ./schemas/mobile-schema.json" ,
89- "identifier" : " mobile-capability" ,
90- "windows" : [" main" ],
91- "platforms" : [" iOS" , " android" ],
92- "permissions" : [
93- " barcode-scanner:allow-scan" ,
94- " barcode-scanner:allow-cancel"
95- ]
91+ "$schema" : " ./schemas/mobile-schema.json" ,
92+ "identifier" : " mobile-capability" ,
93+ "windows" : [" main" ],
94+ "platforms" : [" iOS" , " android" ],
95+ "permissions" : [" barcode-scanner:allow-scan" , " barcode-scanner:allow-cancel" ]
9696}
9797```
9898
99- | Permission | Description |
100- | --- | --- |
101- | ` barcode-scanner:allow-cancel ` | Enables the cancel command without any pre-configured scope. |
102- | ` barcode-scanner:deny-cancel ` | Denies the cancel command without any pre-configured scope. |
103- | ` barcode-scanner:allow-check-permissions ` | Enables the check_permissions command without any pre-configured scope. |
104- | ` barcode-scanner:deny-check-permissions ` | Denies the check_permissions command without any pre-configured scope. |
105- | ` barcode-scanner:allow-open-app-settings ` | Enables the open_app_settings command without any pre-configured scope. |
106- | ` barcode-scanner:deny-open-app-settings ` | Denies the open_app_settings command without any pre-configured scope. |
99+ | Permission | Description |
100+ | ------------------------------------------- | ---------------------------------------------------------------------- --- |
101+ | ` barcode-scanner:allow-cancel ` | Enables the cancel command without any pre-configured scope. |
102+ | ` barcode-scanner:deny-cancel ` | Denies the cancel command without any pre-configured scope. |
103+ | ` barcode-scanner:allow-check-permissions ` | Enables the check_permissions command without any pre-configured scope. |
104+ | ` barcode-scanner:deny-check-permissions ` | Denies the check_permissions command without any pre-configured scope. |
105+ | ` barcode-scanner:allow-open-app-settings ` | Enables the open_app_settings command without any pre-configured scope. |
106+ | ` barcode-scanner:deny-open-app-settings ` | Denies the open_app_settings command without any pre-configured scope. |
107107| ` barcode-scanner:allow-request-permissions ` | Enables the request_permissions command without any pre-configured scope. |
108- | ` barcode-scanner:deny-request-permissions ` | Denies the request_permissions command without any pre-configured scope. |
109- | ` barcode-scanner:allow-scan ` | Enables the scan command without any pre-configured scope. |
110- | ` barcode-scanner:deny-scan ` | Denies the scan command without any pre-configured scope. |
111- | ` barcode-scanner:allow-vibrate ` | Enables the vibrate command without any pre-configured scope. |
112- | ` barcode-scanner:deny-vibrate ` | Denies the vibrate command without any pre-configured scope. |
108+ | ` barcode-scanner:deny-request-permissions ` | Denies the request_permissions command without any pre-configured scope. |
109+ | ` barcode-scanner:allow-scan ` | Enables the scan command without any pre-configured scope. |
110+ | ` barcode-scanner:deny-scan ` | Denies the scan command without any pre-configured scope. |
111+ | ` barcode-scanner:allow-vibrate ` | Enables the vibrate command without any pre-configured scope. |
112+ | ` barcode-scanner:deny-vibrate ` | Denies the vibrate command without any pre-configured scope. |
0 commit comments