html2app • JS Bridge
    Preparing search index...

    Variable ImagePickerConst

    ImagePicker: {
        pickImage(): Promise<MessageResponse<{ file: PickedFile | null }>>;
        pickImages(): Promise<MessageResponse<{ files: PickedFile[] }>>;
    } = ...

    Image picker plugin for choosing images from the device gallery.

    Type Declaration

    Android only for now. Requires the image_picker plugin to be enabled in the app configuration.

    • The gallery opens, and each chosen image is returned as a PickedFile with a localhost URL. Use it in <img src>.
    • If the user cancels, the call still succeeds: file is null for ImagePicker.pickImage and files is empty for ImagePicker.pickImages.
    • Picked images are stored in the app cache. They are deleted when the local server starts or closes, so save an image with FileSaver.saveUrl if you need to keep it.
    import { ImagePicker } from '@yandeu/js-bridge/lib/plugins/imagePicker.js'

    const res = await ImagePicker.pickImage()
    if (res.ok && res.payload.file) img.src = res.payload.file.url