camera.mood
TypeScript icon, indicating that this package has built-in type declarations

1.3.4 • Public • Published

Camera.mood

mediaDevices

Installation

#npm
npm i --save camera.mood

#yarn
yarn add camera.mood

Usage

import { Camera } from 'camera.mood';
import 'camera.mood/dist/camera.css';

const camera = new Camera({ parent: '#app' });
camera.mount();

Props

parent

  • type: string | HTMLElement
  • requred: false
  • default: body

facingMode

  • type: boolean
  • requred: false
  • default: false

className

  • type: string
  • requred: false

facingMode

  • type: boolean
  • requred: false
  • default: false

delay

  • type: number
  • requred: false
  • default: 0

accept

  • type: string
  • requred: false
  • default: image/*

captureButton

  • type: boolean
  • requred: false
  • default: true

loaderButton

  • type: boolean
  • requred: false
  • default: true

delayButton

  • type: boolean
  • requred: false
  • default: true

facingButton

  • type: boolean
  • requred: false
  • default: true

events

onError

const camera = new Camera({
  // ...

  onError(e: any) {
    console.log(e);
  }
});

created

const camera = new Camera({
  // ...

  created() {
    console.log('The camera is ready to be mounted');
  }
});

mounted

const camera = new Camera({
  // ...

  mounted() {
    console.log('The camera is mounted on DOM');
  }
});

updated

const camera = new Camera({
  // ...

  updated() {
    console.log('The camera is updated');
  }
});

captured

const camera = new Camera({
  // ...

  captured(data: CameraObject) {
    console.log(camera.data);
  }
});

functions

mount

mount the camera in DOM

const camera = new Camera({});
camera.mount();

capture

take a picture

const camera = new Camera({});
camera.capture();

remove

delete camera

const camera = new Camera({});
camera.remove();

Author

@domutala

License

MIT

Package Sidebar

Install

npm i camera.mood

Weekly Downloads

0

Version

1.3.4

License

MIT

Unpacked Size

54 kB

Total Files

7

Last publish

Collaborators

  • domoutalla