Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. *
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. *
  20. */
  21. var exec = require('cordova/exec');
  22. var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App';
  23. module.exports = {
  24. /**
  25. * Clear the resource cache.
  26. */
  27. clearCache:function() {
  28. exec(null, null, APP_PLUGIN_NAME, "clearCache", []);
  29. },
  30. /**
  31. * Load the url into the webview or into new browser instance.
  32. *
  33. * @param url The URL to load
  34. * @param props Properties that can be passed in to the activity:
  35. * wait: int => wait msec before loading URL
  36. * loadingDialog: "Title,Message" => display a native loading dialog
  37. * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error
  38. * clearHistory: boolean => clear webview history (default=false)
  39. * openExternal: boolean => open in a new browser (default=false)
  40. *
  41. * Example:
  42. * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
  43. */
  44. loadUrl:function(url, props) {
  45. exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]);
  46. },
  47. /**
  48. * Cancel loadUrl that is waiting to be loaded.
  49. */
  50. cancelLoadUrl:function() {
  51. exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []);
  52. },
  53. /**
  54. * Clear web history in this web view.
  55. * Instead of BACK button loading the previous web page, it will exit the app.
  56. */
  57. clearHistory:function() {
  58. exec(null, null, APP_PLUGIN_NAME, "clearHistory", []);
  59. },
  60. /**
  61. * Go to previous page displayed.
  62. * This is the same as pressing the backbutton on Android device.
  63. */
  64. backHistory:function() {
  65. exec(null, null, APP_PLUGIN_NAME, "backHistory", []);
  66. },
  67. /**
  68. * Override the default behavior of the Android back button.
  69. * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
  70. *
  71. * Note: The user should not have to call this method. Instead, when the user
  72. * registers for the "backbutton" event, this is automatically done.
  73. *
  74. * @param override T=override, F=cancel override
  75. */
  76. overrideBackbutton:function(override) {
  77. exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]);
  78. },
  79. /**
  80. * Override the default behavior of the Android volume button.
  81. * If overridden, when the volume button is pressed, the "volume[up|down]button"
  82. * JavaScript event will be fired.
  83. *
  84. * Note: The user should not have to call this method. Instead, when the user
  85. * registers for the "volume[up|down]button" event, this is automatically done.
  86. *
  87. * @param button volumeup, volumedown
  88. * @param override T=override, F=cancel override
  89. */
  90. overrideButton:function(button, override) {
  91. exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]);
  92. },
  93. /**
  94. * Exit and terminate the application.
  95. */
  96. exitApp:function() {
  97. return exec(null, null, APP_PLUGIN_NAME, "exitApp", []);
  98. }
  99. };