Skip to content

Commit 94b50a3

Browse files
authored
Changes code identation and changes 'opciones' to 'options'
1 parent 7f2da15 commit 94b50a3

File tree

1 file changed

+44
-45
lines changed

1 file changed

+44
-45
lines changed

src/pages/miscellaneous/barcodescanner/barcodescanner.ts

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,51 @@ import { NavController, AlertController } from 'ionic-angular';
33
import { BarcodeScanner } from 'ionic-native';
44

55
@Component({
6-
selector: 'page-barcodescanner',
7-
templateUrl: 'barcodescanner.html'
6+
selector: 'page-barcodescanner',
7+
templateUrl: 'barcodescanner.html'
88
})
99
export class BarcodescannerPage {
1010

11-
public barcodeData;
12-
13-
constructor(public navCtrl: NavController, public alertCtrl: AlertController) {}
14-
15-
ionViewDidLoad() {
16-
console.log('ionViewDidLoad BarcodescannerPage');
17-
}
18-
19-
scan() {
20-
21-
let opciones =
22-
{
23-
preferFrontCamera : false, // iOS and Android
24-
showFlipCameraButton : true, // iOS and Android
25-
showTorchButton : true, // iOS and Android
26-
torchOn: false, // Android, launch with the torch switched on (if available)
27-
prompt : "Place a barcode inside the scan area", // Android
28-
resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500
29-
formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
30-
orientation : "portrait", // Android only (portrait|landscape), default unset so it rotates with the device
31-
disableAnimations : true, // iOS
32-
disableSuccessBeep: false // iOS
33-
};
34-
35-
BarcodeScanner.scan(opciones)
36-
.then((data) => {
37-
this.barcodeData = data;
38-
let alert = this.alertCtrl.create({
39-
title: 'Scan Results',
40-
subTitle: data.text,
41-
buttons: ['OK']
42-
});
43-
alert.present();
44-
}).catch( (err) => {
45-
let alert = this.alertCtrl.create({
46-
title: 'Attention!',
47-
subTitle: err,
48-
buttons: ['Close']
49-
});
50-
alert.present();
51-
});
52-
}
53-
11+
public barcodeData;
12+
13+
constructor(public navCtrl: NavController, public alertCtrl: AlertController) { }
14+
15+
ionViewDidLoad() {
16+
console.log('ionViewDidLoad BarcodescannerPage');
17+
}
18+
19+
scan() {
20+
21+
let options =
22+
{
23+
preferFrontCamera: false, // iOS and Android
24+
showFlipCameraButton: true, // iOS and Android
25+
showTorchButton: true, // iOS and Android
26+
torchOn: false, // Android, launch with the torch switched on (if available)
27+
prompt: "Place a barcode inside the scan area", // Android
28+
resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500
29+
formats: "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
30+
orientation: "portrait", // Android only (portrait|landscape), default unset so it rotates with the device
31+
disableAnimations: true, // iOS
32+
disableSuccessBeep: false // iOS
33+
};
34+
35+
BarcodeScanner.scan(options)
36+
.then((data) => {
37+
this.barcodeData = data;
38+
let alert = this.alertCtrl.create({
39+
title: 'Scan Results',
40+
subTitle: data.text,
41+
buttons: ['OK']
42+
});
43+
alert.present();
44+
}).catch((err) => {
45+
let alert = this.alertCtrl.create({
46+
title: 'Attention!',
47+
subTitle: err,
48+
buttons: ['Close']
49+
});
50+
alert.present();
51+
});
52+
}
5453
}

0 commit comments

Comments
 (0)