I can't get BarcodeScanner to work

Yes, this is what I tried to encode:
BarcodeScanner.encode (BarcodeScanner.Encode.TEXT_TYPE, 'hello world', function (success) { alert ('encode success: ' + success); }, function (fail) { alert ('encode fail: ' + fail); }); return tablRef.key; }

And this is what I tried to scan:
BarcodeScanner.scan (function (success) { console.log (success); }, function (fail) { console.log (fail); }); }

I get this error in both of them

supplied parameters do not match any signature of call target.

Really don’t know what to do.