More demo updates

This commit is contained in:
Ingvar Stepanyan
2023-08-05 19:38:32 +01:00
parent 6c693186c2
commit 0380077969
6 changed files with 31 additions and 11 deletions

View File

@@ -43,7 +43,7 @@
<script type="importmap">
{
"imports": {
"web-gphoto2": "../../src/camera.js",
"web-gphoto2": "./node_modules/web-gphoto2/build/camera.js",
"preact": "https://unpkg.com/preact@10.6.4/dist/preact.module.js",
"preact/debug": "https://unpkg.com/preact@10.6.4/debug/dist/debug.module.js",
"preact/devtools": "https://unpkg.com/preact@10.6.4/devtools/dist/devtools.module.js",

View File

@@ -15,6 +15,9 @@
"version": "0.1.0",
"dev": true,
"license": "LGPL-2.1-or-later",
"dependencies": {
"typescript": "^5.1.6"
},
"devDependencies": {
"@types/emscripten": "^1.39.5"
}
@@ -68,7 +71,8 @@
"web-gphoto2": {
"version": "file:../..",
"requires": {
"@types/emscripten": "^1.39.5"
"@types/emscripten": "^1.39.5",
"typescript": "^5.1.6"
}
}
}

View File

@@ -17,14 +17,14 @@
*/
import { h, Component, createRef } from 'preact';
import { rethrowIfCritical } from './ops.js';
import { rethrowIfCritical } from 'web-gphoto2';
export const isDebug = new URLSearchParams(location.search).has('debug');
const Stats = isDebug
? await import('stats.js').then(
res => /** @type {typeof import('stats.js')} */(res['default'])
)
res => /** @type {typeof import('stats.js')} */ (res['default'])
)
: null;
/** @extends Component<{ getPreview?: () => Promise<Blob> }, { error?: string }> */
@@ -96,9 +96,9 @@ export class Preview extends Component {
blob,
ratio
? {
resizeWidth: canvas.width,
resizeHeight: canvas.height
}
resizeWidth: canvas.width,
resizeHeight: canvas.height
}
: {}
);
if (!ratio) {