Hello everybody,
I’m trying to integrate a native module to scan QR-Codes into my app: (https://github.com/zean00/fuse-qreader)
This is what I did to integrate and use the module:
- Download and put the code into the
libraries
directory:/libraries/fuse-qreader
- Add the module to the
.unoproj
file:
{
"RootNamespace":"stentle.app",
"Packages": [
"Fuse",
"FuseJS",
"Fuse.Scripting"
],
"Includes": [
"*"
],
"Projects": [
"libraries/fuse-qreader/fuse-qreader.unoproj"
]
}
- Import and use the module into my JS code as follows:
function scan() {
var qreader = require('libraries/fuse-qreader/Qreader');
qreader.scan().then(function (res) {
console.log("Scan result: " + res);
}).catch(function(error) {
console.log("Error scanning QR code");
});
}
This is the error printed on the console when the application starts:
Error: : Error message: Uncaught require(): module not found: libraries/fuse-qreader/Qreader
File name: components/js/ScanButton.js
Line number: 15
Source line: var qreader = require('libraries/fuse-qreader/Qreader');
in Fuse.Reactive.DiagnosticSubject<components/js/ScanButton.js:15>
Error: : Error message: Uncaught require(): module not found: libraries/fuse-qreader/Qreader
File name: components/js/ScanButton.js
Line number: 15
Source line: var qreader = require('libraries/fuse-qreader/Qreader');
in Fuse.Reactive.DiagnosticSubject<components/js/ScanButton.js:15>
I tried to change import line as well to var qreader = require('Qreader');
but I got the same error.
Does anybody see what I’m doing wrong here?
Thanks,
Andrea