Flashlight-PhoneGap-Plugin
Flashlight-PhoneGap-Plugin copied to clipboard
Found a issue with your plugin BY 1.1 or 1.3 or 1.4 version
According to this topic https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin/issues/4
it seem the "available" function was broken on 1.1 until 1.4 now,only the 1.0 version is worked~
See #4: please send me your code and I will have a look.
HI @EddyVerbruggen I have already send a email to you tks~
Hi @EddyVerbruggen The 1.4.1 version appear,and it seem solve my problem,tks~ https://build.phonegap.com/plugins/501 I will close this topic by myself
Hi @EddyVerbruggen I found a strange problem in 1.4.1 (1.0 have no this situation),and you told me that will fixed in 1.4.1 but seem not~ (by email XD)
this is my code
window.plugins.flashlight.available(function(isAvailable)
{
if(isAvailable == true)
{
window.plugins.flashlight.switchOn(function() { alert('turn on success'); }, function() { alert('turn on fail'); });
setTimeout(function() { window.plugins.flashlight.switchOff(function() { alert('turn off success'); }, function() { alert('turn off fail'); }); }, 3000);
}
});
1.0 first Execution,the light will turn on second Execution,the light will turn off ....
1.4.1 first Execution,the light seem not turn on (because of I can't see any Light) second Execution,the light will turn on (I can see the light) third Execution,the light will turn of forth...turn on Fifth...turn off ....
hi @EddyVerbruggen I found a way to solve this situation in 1.4.1,don't put the main code at isAvailable inner
window.plugins.flashlight.available(function(isAvailable)
{
if(isAvailable == true)
{
//don't put your code at here,but if I use alert(isAvailable),it will show "true"(it is correct),so strange in 1.4.1
}
});
//just put your code outside
window.plugins.flashlight.switchOn(function() { alert('turn on success'); }, function() { alert('turn on fail'); });
setTimeout(function() { window.plugins.flashlight.switchOff(function() { alert('turn off success'); }, function() { alert('turn off fail'); }); }, 3000);
+1