@yoonit/nativescript-camera
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@yoonit/nativescript-camera", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Yoonit Camera have a custom view that shows a preview layer of the front/back camera and detects human faces in it and read qr code.", | ||
@@ -5,0 +5,0 @@ "main": "Yoonit.Camera", |
@@ -29,2 +29,14 @@ <img src="https://raw.githubusercontent.com/Yoonit-Labs/nativescript-yoonit-camera/development/logo_cyberlabs.png" width="300"> | ||
#### VueJS Plugin | ||
`main.js` | ||
```javascript | ||
import Vue from 'nativescript-vue' | ||
import YoonitCamera from '@yoonit/nativescript-camera/plugin' | ||
Vue.use(YoonitCamera) | ||
``` | ||
After that, you can access the camera object in your entire project using `this.$yoo.camera` | ||
#### Vue Component | ||
@@ -36,3 +48,3 @@ `App.vue` | ||
<YoonitCamera | ||
id="yooCamera" | ||
ref="yooCamera" | ||
@faceDetected="doFaceDetected" | ||
@@ -50,20 +62,13 @@ @faceImage="doFaceImage" | ||
export default { | ||
data: () => ({ | ||
$yoo: null | ||
}), | ||
data: () => ({}), | ||
methods: { | ||
async onLoaded(args) { | ||
this.$yoo = { | ||
camera: null | ||
} | ||
console.log('[YooCamera] Getting Camera view') | ||
this.$yoo.camera = args.object.getViewById('yooCamera') | ||
this.$yoo.camera.registerElement(this.$refs.yooCamera) | ||
console.log('[YooCamera] Getting permission') | ||
const permissionGranted = await this.$yoo.camera.requestPermission() | ||
if (await this.$yoo.camera.requestPermission()) { | ||
console.log('[YooCamera] Permission granted, start preview') | ||
if (permissionGranted) { | ||
console.log('[YooCamera] Permission granted, start preview') | ||
this.$yoo.camera.preview() | ||
@@ -139,2 +144,3 @@ } | ||
|-|-|-|-|-| | ||
| **`requestPermission`** | - | promise | - | Ask to user to give the permission to access camera. | ||
| **`hasPermission`** | - | boolean | - | Return if application has camera permission. | ||
@@ -141,0 +147,0 @@ | **`preview`** | - | void | - | Start camera preview if has permission. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38091
18
674
175