@capturebridge/sdk 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Version.js +1 -1
- package/package.json +1 -1
- package/examples/canon.html +0 -20
- package/examples/canon.js +0 -44
- package/examples/canon_getframe.html +0 -20
- package/examples/canon_getframe.js +0 -46
- package/examples/canon_lan.html +0 -20
- package/examples/canon_lan.js +0 -46
- package/examples/canon_minimal.html +0 -7
- package/examples/canon_minimal.js +0 -27
- package/examples/empty.jpg +0 -0
- package/examples/icao.html +0 -7
- package/examples/icao.jpg +0 -0
- package/examples/icao.js +0 -80
- package/examples/mockcamera.html +0 -20
- package/examples/mockcamera.js +0 -39
- package/examples/mockcamera_getframe.html +0 -20
- package/examples/mockcamera_getframe.js +0 -40
- package/examples/mockcamera_minimal.html +0 -7
- package/examples/mockcamera_minimal.js +0 -21
- package/examples/verifone_signature.html +0 -7
- package/examples/verifone_signature.js +0 -14
- package/examples/windows_scanner_minimal.html +0 -8
- package/examples/windows_scanner_minimal.js +0 -19
package/Version.js
CHANGED
package/package.json
CHANGED
package/examples/canon.html
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head><title>Canon Camera Example</title></head>
|
|
4
|
-
<body>
|
|
5
|
-
<img id="img"/>
|
|
6
|
-
<div>
|
|
7
|
-
<div>
|
|
8
|
-
<label>Rotate</label>
|
|
9
|
-
<input type="number" value="0" id="rotate" min="-360" max="360" step="90"/>
|
|
10
|
-
</div>
|
|
11
|
-
<button type="button" id="capture" title="Capture Image">
|
|
12
|
-
Capture
|
|
13
|
-
</button>
|
|
14
|
-
<button type="button" id="stream" title="Stream Live Feed">
|
|
15
|
-
Stream
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
<script type="module" src="./canon.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
package/examples/canon.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import CanonCamera from '../../../../sdk/js/CanonCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
const defaultSrc = 'empty.jpg'
|
|
4
|
-
const defaultWidth = 400
|
|
5
|
-
const img = document.getElementById('img')
|
|
6
|
-
const capture = document.getElementById('capture')
|
|
7
|
-
const stream = document.getElementById('stream')
|
|
8
|
-
const rotation = document.getElementById('rotate')
|
|
9
|
-
|
|
10
|
-
img.src = defaultSrc
|
|
11
|
-
img.width = defaultWidth
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const camera = new CanonCamera()
|
|
15
|
-
const devices = await camera.devices()
|
|
16
|
-
|
|
17
|
-
if (!devices.length) {
|
|
18
|
-
return window.alert('No Canon Camera devices found')
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Start the first device's live feed and stream it to the img tag
|
|
22
|
-
stream.addEventListener('click', async () => {
|
|
23
|
-
const rotate = parseInt(rotation.value)
|
|
24
|
-
rotation.disabled = true
|
|
25
|
-
stream.disabled = true
|
|
26
|
-
img.src = await camera.streamUrl({ rotate })
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
// Take a full capture and add the image to the page
|
|
30
|
-
capture.addEventListener('click', async () => {
|
|
31
|
-
const rotate = parseInt(rotation.value)
|
|
32
|
-
const capture = document.createElement('img')
|
|
33
|
-
img.src = defaultSrc
|
|
34
|
-
capture.src = await camera.takePhoto({ rotate })
|
|
35
|
-
capture.width = defaultWidth
|
|
36
|
-
document.body.appendChild(capture)
|
|
37
|
-
rotation.disabled = false
|
|
38
|
-
stream.disabled = false
|
|
39
|
-
})
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.error(e)
|
|
42
|
-
window.alert(`Error: ${e.message}`)
|
|
43
|
-
}
|
|
44
|
-
})()
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head><title>Canon Camera Frame Example</title></head>
|
|
4
|
-
<body>
|
|
5
|
-
<div>
|
|
6
|
-
<img id="img"/>
|
|
7
|
-
<div>
|
|
8
|
-
<label>Rotate</label>
|
|
9
|
-
<input type="number" value="0" id="rotate" min="-360" max="360" step="90"/>
|
|
10
|
-
</div>
|
|
11
|
-
<button type="button" id="frame" title="Grab Frame from live feed">
|
|
12
|
-
Get Frame
|
|
13
|
-
</button>
|
|
14
|
-
<button type="button" id="stop" title="Stop live feed">
|
|
15
|
-
Stop Feed
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
<script type="module" src="./canon_getframe.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import CanonCamera from '../../../../sdk/js/CanonCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
const defaultSrc = 'empty.jpg'
|
|
4
|
-
const img = document.getElementById('img')
|
|
5
|
-
const rotation = document.getElementById('rotate')
|
|
6
|
-
const frame = document.getElementById('frame')
|
|
7
|
-
const stop = document.getElementById('stop')
|
|
8
|
-
|
|
9
|
-
img.src = defaultSrc
|
|
10
|
-
img.width = 400
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const camera = new CanonCamera()
|
|
14
|
-
const devices = await camera.devices()
|
|
15
|
-
|
|
16
|
-
if (!devices.length) {
|
|
17
|
-
return window.alert('No Canon Camera devices found')
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Acquiring the first frame will take a few seconds while the camera
|
|
21
|
-
// starts up and begins streaming, subsequent frames will be returned
|
|
22
|
-
// instantaneously
|
|
23
|
-
let lastFrame
|
|
24
|
-
frame.addEventListener('click', async () => {
|
|
25
|
-
stop.disabled = true
|
|
26
|
-
rotation.disabled = true
|
|
27
|
-
const rotate = parseInt(rotation.value)
|
|
28
|
-
// Cleanup the last frame captured, if any
|
|
29
|
-
if (lastFrame) {
|
|
30
|
-
URL.revokeObjectURL(lastFrame)
|
|
31
|
-
}
|
|
32
|
-
img.src = lastFrame = await camera.getMostRecentFrame({ rotate })
|
|
33
|
-
rotation.disabled = false
|
|
34
|
-
stop.disabled = false
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
// Stop live feed
|
|
38
|
-
stop.addEventListener('click', async () => {
|
|
39
|
-
const result = await camera.stopFeed()
|
|
40
|
-
window.alert(result.message || result.status)
|
|
41
|
-
})
|
|
42
|
-
} catch (e) {
|
|
43
|
-
console.error(e)
|
|
44
|
-
window.alert(`Error: ${e.message}`)
|
|
45
|
-
}
|
|
46
|
-
})()
|
package/examples/canon_lan.html
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head><title>Canon Camera LAN Example</title></head>
|
|
4
|
-
<body>
|
|
5
|
-
<img id="img"/>
|
|
6
|
-
<div>
|
|
7
|
-
<div>
|
|
8
|
-
<label>Rotate</label>
|
|
9
|
-
<input type="number" value="0" id="rotate" min="-360" max="360" step="90"/>
|
|
10
|
-
</div>
|
|
11
|
-
<button type="button" id="capture" title="Capture Image">
|
|
12
|
-
Capture
|
|
13
|
-
</button>
|
|
14
|
-
<button type="button" id="stream" title="Stream Live Feed">
|
|
15
|
-
Stream
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
<script type="module" src="./canon_lan.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
package/examples/canon_lan.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import CanonCamera from '../../../../sdk/js/CanonCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
const defaultSrc = 'empty.jpg'
|
|
4
|
-
const defaultWidth = 400
|
|
5
|
-
const img = document.getElementById('img')
|
|
6
|
-
const capture = document.getElementById('capture')
|
|
7
|
-
const stream = document.getElementById('stream')
|
|
8
|
-
const rotation = document.getElementById('rotate')
|
|
9
|
-
|
|
10
|
-
img.src = defaultSrc
|
|
11
|
-
img.width = defaultWidth
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const defaultURL = 'https://windev2-local.capturebridge.net:9001'
|
|
15
|
-
const url = window.prompt('Enter remote Base URL', defaultURL)
|
|
16
|
-
const camera = new CanonCamera(url)
|
|
17
|
-
const devices = await camera.devices()
|
|
18
|
-
|
|
19
|
-
if (!devices.length) {
|
|
20
|
-
return window.alert('No Canon Camera devices found')
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Start the first device's live feed and stream it to the img tag
|
|
24
|
-
stream.addEventListener('click', async () => {
|
|
25
|
-
const rotate = parseInt(rotation.value)
|
|
26
|
-
rotation.disabled = true
|
|
27
|
-
stream.disabled = true
|
|
28
|
-
img.src = await camera.streamUrl({ rotate })
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
// Take a full capture and add the image to the page
|
|
32
|
-
capture.addEventListener('click', async () => {
|
|
33
|
-
const rotate = parseInt(rotation.value)
|
|
34
|
-
const capture = document.createElement('img')
|
|
35
|
-
img.src = defaultSrc
|
|
36
|
-
capture.src = await camera.takePhoto({ rotate })
|
|
37
|
-
capture.width = defaultWidth
|
|
38
|
-
document.body.appendChild(capture)
|
|
39
|
-
rotation.disabled = false
|
|
40
|
-
stream.disabled = false
|
|
41
|
-
})
|
|
42
|
-
} catch (e) {
|
|
43
|
-
console.error(e)
|
|
44
|
-
window.alert(`Error: ${e.message}`)
|
|
45
|
-
}
|
|
46
|
-
})()
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import CanonCamera from '../../../../sdk/js/CanonCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
try {
|
|
4
|
-
// Instantiate a Canon Camera
|
|
5
|
-
const camera = new CanonCamera()
|
|
6
|
-
|
|
7
|
-
const devices = await camera.devices()
|
|
8
|
-
|
|
9
|
-
if (!devices.length) {
|
|
10
|
-
return window.alert('No Canon Camera devices found')
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Start the device's live feed and stream it to an img tag
|
|
14
|
-
const img = document.createElement('img')
|
|
15
|
-
img.src = await camera.streamUrl()
|
|
16
|
-
img.height = 400
|
|
17
|
-
document.body.appendChild(img)
|
|
18
|
-
|
|
19
|
-
// Demo live feed for a few seconds, take a picture, and update the img tag
|
|
20
|
-
setTimeout(async () => {
|
|
21
|
-
img.src = await camera.takePhoto()
|
|
22
|
-
}, 9000)
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error(e)
|
|
25
|
-
window.alert(`Error: ${e.message}`)
|
|
26
|
-
}
|
|
27
|
-
})()
|
package/examples/empty.jpg
DELETED
|
Binary file
|
package/examples/icao.html
DELETED
package/examples/icao.jpg
DELETED
|
Binary file
|
package/examples/icao.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import ICAO from '../../../../sdk/js/ICAO.js'
|
|
2
|
-
import ImageSource from '../../../../sdk/js/ImageSource.js'
|
|
3
|
-
|
|
4
|
-
(async () => {
|
|
5
|
-
try {
|
|
6
|
-
const icao = new ICAO()
|
|
7
|
-
const imgSrc = new ImageSource('icao.jpg', 'url')
|
|
8
|
-
|
|
9
|
-
// Perform an ICAO check against the provided Image and return cropped
|
|
10
|
-
const results = await icao.check(imgSrc, true, '#a5a5a5')
|
|
11
|
-
|
|
12
|
-
// Our stock photo is zoomed in too close, so we pad the canvas to allow for
|
|
13
|
-
// drawing a box around the cropped portion
|
|
14
|
-
const padding = 150
|
|
15
|
-
|
|
16
|
-
// stroke/arc color
|
|
17
|
-
const color = 'rgba(0,255,0,0.5)'
|
|
18
|
-
|
|
19
|
-
// Load the image and draw it on a Canvas
|
|
20
|
-
const img = await imgSrc.toImage()
|
|
21
|
-
const canvas = document.createElement('canvas')
|
|
22
|
-
const ctx = canvas.getContext('2d')
|
|
23
|
-
canvas.width = img.width + padding
|
|
24
|
-
canvas.height = img.height + padding
|
|
25
|
-
ctx.drawImage(img, padding / 2, padding / 2, img.width, img.height)
|
|
26
|
-
|
|
27
|
-
document.body.appendChild(canvas)
|
|
28
|
-
|
|
29
|
-
ctx.strokeStyle = color
|
|
30
|
-
ctx.lineWidth = 4
|
|
31
|
-
|
|
32
|
-
// Insert cropped image into the DOM
|
|
33
|
-
const croppedSrc = new ImageSource(results.cropped)
|
|
34
|
-
document.body.appendChild(await croppedSrc.toImage())
|
|
35
|
-
|
|
36
|
-
// Draw points for left and right eye
|
|
37
|
-
ctx.beginPath()
|
|
38
|
-
ctx.arc(results.face.left_eye.x + padding / 2,
|
|
39
|
-
results.face.left_eye.y + padding / 2, 5, 0, 2 * Math.PI)
|
|
40
|
-
ctx.fillStyle = color
|
|
41
|
-
ctx.fill()
|
|
42
|
-
|
|
43
|
-
ctx.beginPath()
|
|
44
|
-
ctx.arc(results.face.right_eye.x + padding / 2,
|
|
45
|
-
results.face.right_eye.y + padding / 2, 5, 0, 2 * Math.PI)
|
|
46
|
-
ctx.fillStyle = color
|
|
47
|
-
ctx.fill()
|
|
48
|
-
|
|
49
|
-
// Draw bounding box where image was cropped
|
|
50
|
-
ctx.beginPath()
|
|
51
|
-
ctx.moveTo(results.crop_boundary[0].x + padding / 2,
|
|
52
|
-
results.crop_boundary[0].y + padding / 2)
|
|
53
|
-
for (let i = 1; i < results.crop_boundary.length; i++) {
|
|
54
|
-
ctx.lineTo(results.crop_boundary[i].x + padding / 2,
|
|
55
|
-
results.crop_boundary[i].y + padding / 2)
|
|
56
|
-
}
|
|
57
|
-
ctx.closePath()
|
|
58
|
-
ctx.stroke()
|
|
59
|
-
|
|
60
|
-
// Display ICAO attributes
|
|
61
|
-
const output = document.createElement('textarea')
|
|
62
|
-
output.style.display = 'block'
|
|
63
|
-
output.rows = 35
|
|
64
|
-
output.cols = 50
|
|
65
|
-
output.value = '# Checks\n\n'
|
|
66
|
-
document.body.appendChild(output)
|
|
67
|
-
results.attributes.filter(attr => attr.type === 'check').forEach(({ id, score, compliant }) => {
|
|
68
|
-
output.value += (compliant ? '✅' : '❌') + `${id}: ${score}\n`
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
output.value += '\n\n# Data\n\n'
|
|
72
|
-
|
|
73
|
-
results.attributes.filter(attr => attr.type === 'data').forEach(({ id, score, data }) => {
|
|
74
|
-
output.value += `${id}: ${data || score}\n`
|
|
75
|
-
})
|
|
76
|
-
} catch (e) {
|
|
77
|
-
console.error(e)
|
|
78
|
-
window.alert(`Error: ${e.message}`)
|
|
79
|
-
}
|
|
80
|
-
})()
|
package/examples/mockcamera.html
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head><title>Mock Camera Example</title></head>
|
|
4
|
-
<body>
|
|
5
|
-
<img id="img" src="empty.jpg"/>
|
|
6
|
-
<div>
|
|
7
|
-
<div>
|
|
8
|
-
<label>Rotate</label>
|
|
9
|
-
<input type="number" value="0" id="rotate" min="-360" max="360" step="90"/>
|
|
10
|
-
</div>
|
|
11
|
-
<button type="button" id="capture" title="Capture Image">
|
|
12
|
-
Capture
|
|
13
|
-
</button>
|
|
14
|
-
<button type="button" id="stream" title="Stream Live Feed">
|
|
15
|
-
Stream
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
<script type="module" src="./mockcamera.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
package/examples/mockcamera.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import MockCamera from '../../../../sdk/js/MockCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
const defaultSrc = 'empty.jpg'
|
|
4
|
-
const defaultWidth = 400
|
|
5
|
-
const img = document.getElementById('img')
|
|
6
|
-
const capture = document.getElementById('capture')
|
|
7
|
-
const stream = document.getElementById('stream')
|
|
8
|
-
const rotation = document.getElementById('rotate')
|
|
9
|
-
|
|
10
|
-
img.src = defaultSrc
|
|
11
|
-
img.width = defaultWidth
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const camera = new MockCamera()
|
|
15
|
-
|
|
16
|
-
// Start the first device's live feed and stream it to the img tag
|
|
17
|
-
stream.addEventListener('click', async () => {
|
|
18
|
-
const rotate = parseInt(rotation.value)
|
|
19
|
-
rotation.disabled = true
|
|
20
|
-
stream.disabled = true
|
|
21
|
-
img.src = await camera.streamUrl({ rotate })
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
// Take a full capture and add the image to the page
|
|
25
|
-
capture.addEventListener('click', async () => {
|
|
26
|
-
const rotate = parseInt(rotation.value)
|
|
27
|
-
const capture = document.createElement('img')
|
|
28
|
-
img.src = defaultSrc
|
|
29
|
-
capture.src = await camera.takePhoto({ rotate })
|
|
30
|
-
capture.width = defaultWidth
|
|
31
|
-
document.body.appendChild(capture)
|
|
32
|
-
rotation.disabled = false
|
|
33
|
-
stream.disabled = false
|
|
34
|
-
})
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.error(e)
|
|
37
|
-
window.alert(`Error: ${e.message}`)
|
|
38
|
-
}
|
|
39
|
-
})()
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head><title>Mock Camera Frame Example</title></head>
|
|
4
|
-
<body>
|
|
5
|
-
<div>
|
|
6
|
-
<img id="img"/>
|
|
7
|
-
<div>
|
|
8
|
-
<label>Rotate</label>
|
|
9
|
-
<input type="number" value="0" id="rotate" min="-360" max="360" step="90"/>
|
|
10
|
-
</div>
|
|
11
|
-
<button type="button" id="frame" title="Grab Frame from live feed">
|
|
12
|
-
Get Frame
|
|
13
|
-
</button>
|
|
14
|
-
<button type="button" id="stop" title="Stop live feed">
|
|
15
|
-
Stop Feed
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
<script type="module" src="./mockcamera_getframe.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import MockCamera from '../../../../sdk/js/MockCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
const defaultSrc = 'empty.jpg'
|
|
4
|
-
const img = document.getElementById('img')
|
|
5
|
-
const rotation = document.getElementById('rotate')
|
|
6
|
-
const frame = document.getElementById('frame')
|
|
7
|
-
const stop = document.getElementById('stop')
|
|
8
|
-
|
|
9
|
-
img.src = defaultSrc
|
|
10
|
-
img.width = 400
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const camera = new MockCamera()
|
|
14
|
-
|
|
15
|
-
// Grab a frame from the live feed
|
|
16
|
-
let lastFrame
|
|
17
|
-
frame.addEventListener('click', async () => {
|
|
18
|
-
stop.disabled = true
|
|
19
|
-
rotation.disabled = true
|
|
20
|
-
const rotate = parseInt(rotation.value)
|
|
21
|
-
// Cleanup the last frame captured, if any
|
|
22
|
-
if (lastFrame) {
|
|
23
|
-
URL.revokeObjectURL(lastFrame)
|
|
24
|
-
}
|
|
25
|
-
img.src = lastFrame = await camera.getMostRecentFrame({ rotate })
|
|
26
|
-
document.body.appendChild(frame)
|
|
27
|
-
rotation.disabled = false
|
|
28
|
-
stop.disabled = false
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
// Stop live feed
|
|
32
|
-
stop.addEventListener('click', async () => {
|
|
33
|
-
const result = await camera.stopFeed()
|
|
34
|
-
window.alert(result.message || result.status)
|
|
35
|
-
})
|
|
36
|
-
} catch (e) {
|
|
37
|
-
console.error(e)
|
|
38
|
-
window.alert(`Error: ${e.message}`)
|
|
39
|
-
}
|
|
40
|
-
})()
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import MockCamera from '../../../../sdk/js/MockCamera.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
try {
|
|
4
|
-
// Instantiate a Mock Camera
|
|
5
|
-
const camera = new MockCamera()
|
|
6
|
-
|
|
7
|
-
// Start the device's live feed and stream it to an img tag
|
|
8
|
-
const img = document.createElement('img')
|
|
9
|
-
img.src = await camera.streamUrl()
|
|
10
|
-
img.height = 400
|
|
11
|
-
document.body.appendChild(img)
|
|
12
|
-
|
|
13
|
-
// Demo live feed for a few seconds, take a picture, and update the img tag
|
|
14
|
-
setTimeout(async () => {
|
|
15
|
-
img.src = await camera.takePhoto()
|
|
16
|
-
}, 9000)
|
|
17
|
-
} catch (e) {
|
|
18
|
-
console.error(e)
|
|
19
|
-
window.alert(`Error: ${e.message}`)
|
|
20
|
-
}
|
|
21
|
-
})()
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Verifone from '../../../../sdk/js/Verifone.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
try {
|
|
4
|
-
const tablet = new Verifone()
|
|
5
|
-
|
|
6
|
-
const img = document.createElement('img')
|
|
7
|
-
img.src = await tablet.signature({ format: 'jpg' })
|
|
8
|
-
await tablet.clear()
|
|
9
|
-
document.body.appendChild(img)
|
|
10
|
-
} catch (e) {
|
|
11
|
-
console.error(e)
|
|
12
|
-
window.alert(`Error: ${e.message}`)
|
|
13
|
-
}
|
|
14
|
-
})()
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import WindowsScanner from '../../../../sdk/js/WindowsScanner.js'
|
|
2
|
-
(async () => {
|
|
3
|
-
try {
|
|
4
|
-
const scanner = new WindowsScanner()
|
|
5
|
-
|
|
6
|
-
const devices = await scanner.devices()
|
|
7
|
-
|
|
8
|
-
if (!devices.length) {
|
|
9
|
-
return window.alert('No Scanner devices found')
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const img = document.createElement('img')
|
|
13
|
-
img.src = await scanner.scan()
|
|
14
|
-
document.body.appendChild(img)
|
|
15
|
-
} catch (e) {
|
|
16
|
-
console.error(e)
|
|
17
|
-
window.alert(`Error: ${e.message}`)
|
|
18
|
-
}
|
|
19
|
-
})()
|