Define BarcodeScanner Hook
This commit is contained in:
+6
-2
@@ -21,12 +21,16 @@ import "phoenix_html"
|
||||
import { Socket } from "phoenix"
|
||||
import { LiveSocket } from "phoenix_live_view"
|
||||
import topbar from "../vendor/topbar"
|
||||
import "./barcode-scanner"
|
||||
import BarcodeScannerHook from "./barcode-scanner"
|
||||
|
||||
let Hooks = {}
|
||||
Hooks.BarcodeScanner = BarcodeScannerHook;
|
||||
|
||||
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
|
||||
let liveSocket = new LiveSocket("/live", Socket, {
|
||||
longPollFallbackMs: 2500,
|
||||
params: { _csrf_token: csrfToken }
|
||||
params: { _csrf_token: csrfToken },
|
||||
hooks: { Hooks }
|
||||
})
|
||||
|
||||
// Show progress bar on live navigation and form submits
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BarcodeDetector } from "barcode-detector/ponyfill";
|
||||
|
||||
const run = async function () {
|
||||
const barcodeTest = async function () {
|
||||
// check supported formats
|
||||
const supportedFormats = await BarcodeDetector.getSupportedFormats();
|
||||
console.log(supportedFormats);
|
||||
@@ -17,4 +17,8 @@ const run = async function () {
|
||||
barcodeDetector.detect(imageFile).then(console.log);
|
||||
}
|
||||
|
||||
run();
|
||||
export default {
|
||||
mounted() {
|
||||
console.log(this.el);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user