1
コードバーバーコードスキャナを使用していますが、このようなサンプルがあります。
コメントがあるにもかかわらず、ここでsetTimeoutがなぜ必要なのかがわかりません。
ダイアログがアプリケーションを解放しないということはどういう意味ですか?タイムアウトでアラートが折り返される
cordova.plugins.barcodeScanner.scan(
// success callback function
function (result) {
// wrapping in a timeout so the dialog doesn't free the app
setTimeout(function() {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
}, 0);
},
// error callback function
function (error) {
alert("Scanning failed: " + error);
},
// options object
{
...
}
http://stackoverflow.com/questions/36108158/why-would-i-wrap-a-function-in-angularjs-timeout-service-without-a-delay-like-t – Marko