diff --git a/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts
new file mode 100644
index 0000000000..7b1f23a3fd
--- /dev/null
+++ b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts
@@ -0,0 +1,29 @@
+///
+///
+
+cordova.plugins.barcodeScanner.scan(
+ function (result) {
+ alert("We got a barcode\n" +
+ "Result: " + result.text + "\n" +
+ "Format: " + result.format + "\n" +
+ "Cancelled: " + result.cancelled);
+ },
+ function (error) {
+ alert("Scanning failed: " + error);
+ },
+ {
+ "preferFrontCamera" : true, // iOS and Android
+ "showFlipCameraButton" : true, // iOS and Android
+ "prompt" : "Place a barcode inside the scan area", // supported on Android only
+ "formats" : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
+ "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device
+ }
+);
+
+
+cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
+ alert("encode success: " + success);
+ }, function(fail) {
+ alert("encoding failed: " + fail);
+ }
+);
\ No newline at end of file
diff --git a/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner.d.ts b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner.d.ts
new file mode 100644
index 0000000000..85bde977b7
--- /dev/null
+++ b/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner.d.ts
@@ -0,0 +1,37 @@
+// Type definitions for phonegap-plugin-barcodescanner
+// Project: https://github.com/phonegap/phonegap-plugin-barcodescanner
+// Definitions by: Nathan Ainslie
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+interface CordovaPlugins {
+ barcodeScanner: phonegapBarcode.BarcodeScanner;
+}
+
+declare namespace phonegapBarcode {
+ interface BarcodeScanResult {
+ text: string;
+ format: string;
+ cancelled: boolean;
+ }
+
+ interface BarcodeScanOptions {
+ preferFrontCamera?: boolean;
+ showFlipCameraButton?: boolean;
+ prompt?: string;
+ formats?: string;
+ orientation?: "landscape" | "portrait";
+ }
+
+ interface EncodingType {
+ TEXT_TYPE: any;
+ EMAIL_TYPE: any;
+ PHONE_TYPE: any;
+ SMS_TYPE: any;
+ }
+
+ interface BarcodeScanner {
+ scan: (success: ((result: BarcodeScanResult) => any), failure?: ((err: any) => any), opts?: BarcodeScanOptions) => void;
+ encode: (encodingType: EncodingType, data: string, success: ((result: any) => any), failure?: ((err: any) => any)) => void;
+ Encode: EncodingType;
+ }
+}
\ No newline at end of file