/Android/Torch/2.1/Torch.js

http://github.com/phonegap/phonegap-plugins · JavaScript · 68 lines · 27 code · 9 blank · 32 comment · 2 complexity · c8b6ef419de89e75d9981b498161452f MD5 · raw file

  1. /**
  2. * Phonegap Torch plugin
  3. * Copyright (c) Arne de Bree 2011
  4. *
  5. */
  6. /**
  7. *
  8. * @return Object literal singleton instance of Torch
  9. */
  10. var Torch = function() {};
  11. /**
  12. * @param success The callback for success
  13. * @param error The callback for error
  14. */
  15. Torch.prototype.isCapable = function( success, error )
  16. {
  17. return cordova.exec( success, error, "Torch", "isCapable", [] );
  18. };
  19. /**
  20. * @param success The callback for success
  21. * @param error The callback for error
  22. */
  23. Torch.prototype.isOn = function( success, error )
  24. {
  25. return cordova.exec( success, error, "Torch", "isOn", [] );
  26. };
  27. /**
  28. * @param success The callback for success
  29. * @param error The callback for error
  30. */
  31. Torch.prototype.turnOn = function( success, error )
  32. {
  33. return cordova.exec( success, error, "Torch", "turnOn", [] );
  34. };
  35. /**
  36. * @param success The callback for success
  37. * @param error The callback for error
  38. */
  39. Torch.prototype.turnOff = function( success, error )
  40. {
  41. return cordova.exec( success, error, "Torch", "turnOff", [] );
  42. };
  43. /**
  44. * @param success The callback for success
  45. * @param error The callback for error
  46. */
  47. Torch.prototype.toggle = function( success, error )
  48. {
  49. return cordova.exec( success, error, "Torch", "toggle", [] );
  50. };
  51. /**
  52. * Load Analytics
  53. */
  54. if(!window.plugins) {
  55. window.plugins = {};
  56. }
  57. if (!window.plugins.Torch) {
  58. window.plugins.Torch = new Torch();
  59. }