bundle.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. 'use strict';
  2. var rxjs = require('rxjs');
  3. /**
  4. *
  5. */
  6. function checkReady() {
  7. if (typeof process === 'undefined') {
  8. var win_1 = typeof window !== 'undefined' ? window : {};
  9. var DEVICE_READY_TIMEOUT_1 = 5000;
  10. // To help developers using cordova, we listen for the device ready event and
  11. // log an error if it didn't fire in a reasonable amount of time. Generally,
  12. // when this happens, developers should remove and reinstall plugins, since
  13. // an inconsistent plugin is often the culprit.
  14. var before_1 = Date.now();
  15. var didFireReady_1 = false;
  16. win_1.document.addEventListener('deviceready', function () {
  17. console.log("Ionic Native: deviceready event fired after " + (Date.now() - before_1) + " ms");
  18. didFireReady_1 = true;
  19. });
  20. setTimeout(function () {
  21. if (!didFireReady_1 && win_1.cordova) {
  22. console.warn("Ionic Native: deviceready did not fire within " + DEVICE_READY_TIMEOUT_1 + "ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.");
  23. }
  24. }, DEVICE_READY_TIMEOUT_1);
  25. }
  26. }
  27. var ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
  28. var ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
  29. /**
  30. * @param callback
  31. */
  32. function getPromise(callback) {
  33. var tryNativePromise = function () {
  34. if (Promise) {
  35. return new Promise(function (resolve, reject) {
  36. callback(resolve, reject);
  37. });
  38. }
  39. else {
  40. console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.');
  41. }
  42. };
  43. if (typeof window !== 'undefined' && window.angular) {
  44. var doc = window.document;
  45. var injector = window.angular.element(doc.querySelector('[ng-app]') || doc.body).injector();
  46. if (injector) {
  47. var $q = injector.get('$q');
  48. return $q(function (resolve, reject) {
  49. callback(resolve, reject);
  50. });
  51. }
  52. console.warn("Angular 1 was detected but $q couldn't be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won't trigger an automatic digest when promises resolve.");
  53. }
  54. return tryNativePromise();
  55. }
  56. /**
  57. * @param pluginObj
  58. * @param methodName
  59. * @param args
  60. * @param opts
  61. */
  62. function wrapPromise(pluginObj, methodName, args, opts) {
  63. if (opts === void 0) { opts = {}; }
  64. var pluginResult, rej;
  65. var p = getPromise(function (resolve, reject) {
  66. if (opts.destruct) {
  67. pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, function () {
  68. var args = [];
  69. for (var _i = 0; _i < arguments.length; _i++) {
  70. args[_i] = arguments[_i];
  71. }
  72. return resolve(args);
  73. }, function () {
  74. var args = [];
  75. for (var _i = 0; _i < arguments.length; _i++) {
  76. args[_i] = arguments[_i];
  77. }
  78. return reject(args);
  79. });
  80. }
  81. else {
  82. pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
  83. }
  84. rej = reject;
  85. });
  86. // Angular throws an error on unhandled rejection, but in this case we have already printed
  87. // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
  88. // to error
  89. if (pluginResult && pluginResult.error) {
  90. p.catch(function () { });
  91. typeof rej === 'function' && rej(pluginResult.error);
  92. }
  93. return p;
  94. }
  95. /**
  96. * @param pluginObj
  97. * @param methodName
  98. * @param args
  99. * @param opts
  100. */
  101. function wrapOtherPromise(pluginObj, methodName, args, opts) {
  102. if (opts === void 0) { opts = {}; }
  103. return getPromise(function (resolve, reject) {
  104. var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
  105. if (pluginResult) {
  106. if (pluginResult.error) {
  107. reject(pluginResult.error);
  108. }
  109. else if (pluginResult.then) {
  110. pluginResult.then(resolve).catch(reject);
  111. }
  112. }
  113. else {
  114. reject({ error: 'unexpected_error' });
  115. }
  116. });
  117. }
  118. /**
  119. * @param pluginObj
  120. * @param methodName
  121. * @param args
  122. * @param opts
  123. */
  124. function wrapObservable(pluginObj, methodName, args, opts) {
  125. if (opts === void 0) { opts = {}; }
  126. return new rxjs.Observable(function (observer) {
  127. var pluginResult;
  128. if (opts.destruct) {
  129. pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, function () {
  130. var args = [];
  131. for (var _i = 0; _i < arguments.length; _i++) {
  132. args[_i] = arguments[_i];
  133. }
  134. return observer.next(args);
  135. }, function () {
  136. var args = [];
  137. for (var _i = 0; _i < arguments.length; _i++) {
  138. args[_i] = arguments[_i];
  139. }
  140. return observer.error(args);
  141. });
  142. }
  143. else {
  144. pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
  145. }
  146. if (pluginResult && pluginResult.error) {
  147. observer.error(pluginResult.error);
  148. observer.complete();
  149. }
  150. return function () {
  151. try {
  152. if (opts.clearFunction) {
  153. if (opts.clearWithArgs) {
  154. return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
  155. }
  156. return callCordovaPlugin(pluginObj, opts.clearFunction, []);
  157. }
  158. }
  159. catch (e) {
  160. console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
  161. console.warn(e);
  162. }
  163. };
  164. });
  165. }
  166. /**
  167. * Wrap the event with an observable
  168. *
  169. * @private
  170. * @param event event name
  171. * @param element The element to attach the event listener to
  172. * @returns {Observable}
  173. */
  174. function wrapEventObservable(event, element) {
  175. element =
  176. typeof window !== 'undefined' && element
  177. ? get$1(window, element)
  178. : element || (typeof window !== 'undefined' ? window : {});
  179. return rxjs.fromEvent(element, event);
  180. }
  181. /**
  182. * @param plugin
  183. * @param methodName
  184. * @param pluginName
  185. */
  186. function checkAvailability(plugin, methodName, pluginName) {
  187. var pluginRef, pluginPackage;
  188. if (typeof plugin === 'string') {
  189. pluginRef = plugin;
  190. }
  191. else {
  192. pluginRef = plugin.constructor.getPluginRef();
  193. pluginName = plugin.constructor.getPluginName();
  194. pluginPackage = plugin.constructor.getPluginInstallName();
  195. }
  196. var pluginInstance = getPlugin(pluginRef);
  197. if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
  198. if (typeof window === 'undefined' || !window.cordova) {
  199. cordovaWarn(pluginName, methodName);
  200. return ERR_CORDOVA_NOT_AVAILABLE;
  201. }
  202. pluginWarn(pluginName, pluginPackage, methodName);
  203. return ERR_PLUGIN_NOT_INSTALLED;
  204. }
  205. return true;
  206. }
  207. /**
  208. * Checks if _objectInstance exists and has the method/property
  209. *
  210. * @param pluginObj
  211. * @param methodName
  212. * @private
  213. */
  214. function instanceAvailability(pluginObj, methodName) {
  215. return pluginObj._objectInstance && (!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined');
  216. }
  217. /**
  218. * @param args
  219. * @param opts
  220. * @param resolve
  221. * @param reject
  222. */
  223. function setIndex(args, opts, resolve, reject) {
  224. if (opts === void 0) { opts = {}; }
  225. // ignore resolve and reject in case sync
  226. if (opts.sync) {
  227. return args;
  228. }
  229. // If the plugin method expects myMethod(success, err, options)
  230. if (opts.callbackOrder === 'reverse') {
  231. // Get those arguments in the order [resolve, reject, ...restOfArgs]
  232. args.unshift(reject);
  233. args.unshift(resolve);
  234. }
  235. else if (opts.callbackStyle === 'node') {
  236. args.push(function (err, result) {
  237. if (err) {
  238. reject(err);
  239. }
  240. else {
  241. resolve(result);
  242. }
  243. });
  244. }
  245. else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
  246. var obj = {};
  247. obj[opts.successName] = resolve;
  248. obj[opts.errorName] = reject;
  249. args.push(obj);
  250. }
  251. else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
  252. var setSuccessIndex = function () {
  253. // If we've specified a success/error index
  254. if (opts.successIndex > args.length) {
  255. args[opts.successIndex] = resolve;
  256. }
  257. else {
  258. args.splice(opts.successIndex, 0, resolve);
  259. }
  260. };
  261. var setErrorIndex = function () {
  262. // We don't want that the reject cb gets spliced into the position of an optional argument that has not been
  263. // defined and thus causing non expected behavior.
  264. if (opts.errorIndex > args.length) {
  265. args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
  266. }
  267. else {
  268. args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
  269. }
  270. };
  271. if (opts.successIndex > opts.errorIndex) {
  272. setErrorIndex();
  273. setSuccessIndex();
  274. }
  275. else {
  276. setSuccessIndex();
  277. setErrorIndex();
  278. }
  279. }
  280. else {
  281. // Otherwise, let's tack them on to the end of the argument list
  282. // which is 90% of cases
  283. args.push(resolve);
  284. args.push(reject);
  285. }
  286. return args;
  287. }
  288. /**
  289. * @param pluginObj
  290. * @param methodName
  291. * @param args
  292. * @param opts
  293. * @param resolve
  294. * @param reject
  295. */
  296. function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
  297. if (opts === void 0) { opts = {}; }
  298. // Try to figure out where the success/error callbacks need to be bound
  299. // to our promise resolve/reject handlers.
  300. args = setIndex(args, opts, resolve, reject);
  301. var availabilityCheck = checkAvailability(pluginObj, methodName);
  302. if (availabilityCheck === true) {
  303. var pluginInstance = getPlugin(pluginObj.constructor.getPluginRef());
  304. // eslint-disable-next-line prefer-spread
  305. return pluginInstance[methodName].apply(pluginInstance, args);
  306. }
  307. else {
  308. return availabilityCheck;
  309. }
  310. }
  311. /**
  312. * @param pluginObj
  313. * @param methodName
  314. * @param args
  315. * @param opts
  316. * @param resolve
  317. * @param reject
  318. */
  319. function callInstance(pluginObj, methodName, args, opts, resolve, reject) {
  320. if (opts === void 0) { opts = {}; }
  321. args = setIndex(args, opts, resolve, reject);
  322. if (instanceAvailability(pluginObj, methodName)) {
  323. // eslint-disable-next-line prefer-spread
  324. return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
  325. }
  326. }
  327. /**
  328. * @param pluginRef
  329. */
  330. function getPlugin(pluginRef) {
  331. if (typeof window !== 'undefined') {
  332. return get$1(window, pluginRef);
  333. }
  334. return null;
  335. }
  336. /**
  337. * @param element
  338. * @param path
  339. */
  340. function get$1(element, path) {
  341. var paths = path.split('.');
  342. var obj = element;
  343. for (var i = 0; i < paths.length; i++) {
  344. if (!obj) {
  345. return null;
  346. }
  347. obj = obj[paths[i]];
  348. }
  349. return obj;
  350. }
  351. /**
  352. * @param pluginName
  353. * @param plugin
  354. * @param method
  355. */
  356. function pluginWarn(pluginName, plugin, method) {
  357. if (method) {
  358. console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
  359. }
  360. else {
  361. console.warn("Native: tried accessing the " + pluginName + " plugin but it's not installed.");
  362. }
  363. if (plugin) {
  364. console.warn("Install the " + pluginName + " plugin: 'ionic cordova plugin add " + plugin + "'");
  365. }
  366. }
  367. /**
  368. * @private
  369. * @param pluginName
  370. * @param method
  371. */
  372. function cordovaWarn(pluginName, method) {
  373. if (typeof process === 'undefined') {
  374. if (method) {
  375. console.warn('Native: tried calling ' +
  376. pluginName +
  377. '.' +
  378. method +
  379. ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
  380. }
  381. else {
  382. console.warn('Native: tried accessing the ' +
  383. pluginName +
  384. ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
  385. }
  386. }
  387. }
  388. /**
  389. * @param pluginObj
  390. * @param methodName
  391. * @param opts
  392. * @private
  393. */
  394. var wrap = function (pluginObj, methodName, opts) {
  395. if (opts === void 0) { opts = {}; }
  396. return function () {
  397. var args = [];
  398. for (var _i = 0; _i < arguments.length; _i++) {
  399. args[_i] = arguments[_i];
  400. }
  401. if (opts.sync) {
  402. // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
  403. return callCordovaPlugin(pluginObj, methodName, args, opts);
  404. }
  405. else if (opts.observable) {
  406. return wrapObservable(pluginObj, methodName, args, opts);
  407. }
  408. else if (opts.eventObservable && opts.event) {
  409. return wrapEventObservable(opts.event, opts.element);
  410. }
  411. else if (opts.otherPromise) {
  412. return wrapOtherPromise(pluginObj, methodName, args, opts);
  413. }
  414. else {
  415. return wrapPromise(pluginObj, methodName, args, opts);
  416. }
  417. };
  418. };
  419. /**
  420. * @param pluginObj
  421. * @param methodName
  422. * @param opts
  423. * @private
  424. */
  425. function wrapInstance(pluginObj, methodName, opts) {
  426. if (opts === void 0) { opts = {}; }
  427. return function () {
  428. var args = [];
  429. for (var _i = 0; _i < arguments.length; _i++) {
  430. args[_i] = arguments[_i];
  431. }
  432. if (opts.sync) {
  433. return callInstance(pluginObj, methodName, args, opts);
  434. }
  435. else if (opts.observable) {
  436. return new rxjs.Observable(function (observer) {
  437. var pluginResult;
  438. if (opts.destruct) {
  439. pluginResult = callInstance(pluginObj, methodName, args, opts, function () {
  440. var args = [];
  441. for (var _i = 0; _i < arguments.length; _i++) {
  442. args[_i] = arguments[_i];
  443. }
  444. return observer.next(args);
  445. }, function () {
  446. var args = [];
  447. for (var _i = 0; _i < arguments.length; _i++) {
  448. args[_i] = arguments[_i];
  449. }
  450. return observer.error(args);
  451. });
  452. }
  453. else {
  454. pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
  455. }
  456. if (pluginResult && pluginResult.error) {
  457. observer.error(pluginResult.error);
  458. }
  459. return function () {
  460. try {
  461. if (opts.clearWithArgs) {
  462. return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
  463. }
  464. return callInstance(pluginObj, opts.clearFunction, []);
  465. }
  466. catch (e) {
  467. console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
  468. console.warn(e);
  469. }
  470. };
  471. });
  472. }
  473. else if (opts.otherPromise) {
  474. return getPromise(function (resolve, reject) {
  475. var result;
  476. if (opts.destruct) {
  477. result = callInstance(pluginObj, methodName, args, opts, function () {
  478. var args = [];
  479. for (var _i = 0; _i < arguments.length; _i++) {
  480. args[_i] = arguments[_i];
  481. }
  482. return resolve(args);
  483. }, function () {
  484. var args = [];
  485. for (var _i = 0; _i < arguments.length; _i++) {
  486. args[_i] = arguments[_i];
  487. }
  488. return reject(args);
  489. });
  490. }
  491. else {
  492. result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
  493. }
  494. if (result && result.then) {
  495. result.then(resolve, reject);
  496. }
  497. else {
  498. reject();
  499. }
  500. });
  501. }
  502. else {
  503. var pluginResult_1, rej_1;
  504. var p = getPromise(function (resolve, reject) {
  505. if (opts.destruct) {
  506. pluginResult_1 = callInstance(pluginObj, methodName, args, opts, function () {
  507. var args = [];
  508. for (var _i = 0; _i < arguments.length; _i++) {
  509. args[_i] = arguments[_i];
  510. }
  511. return resolve(args);
  512. }, function () {
  513. var args = [];
  514. for (var _i = 0; _i < arguments.length; _i++) {
  515. args[_i] = arguments[_i];
  516. }
  517. return reject(args);
  518. });
  519. }
  520. else {
  521. pluginResult_1 = callInstance(pluginObj, methodName, args, opts, resolve, reject);
  522. }
  523. rej_1 = reject;
  524. });
  525. // Angular throws an error on unhandled rejection, but in this case we have already printed
  526. // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
  527. // to error
  528. if (pluginResult_1 && pluginResult_1.error) {
  529. p.catch(function () { });
  530. typeof rej_1 === 'function' && rej_1(pluginResult_1.error);
  531. }
  532. return p;
  533. }
  534. };
  535. }
  536. /**
  537. * @param element
  538. * @param path
  539. * @private
  540. */
  541. function get(element, path) {
  542. var paths = path.split('.');
  543. var obj = element;
  544. for (var i = 0; i < paths.length; i++) {
  545. if (!obj) {
  546. return null;
  547. }
  548. obj = obj[paths[i]];
  549. }
  550. return obj;
  551. }
  552. var AwesomeCordovaNativePlugin = /** @class */ (function () {
  553. function AwesomeCordovaNativePlugin() {
  554. }
  555. /**
  556. * Returns a boolean that indicates whether the plugin is installed
  557. *
  558. * @returns {boolean}
  559. */
  560. AwesomeCordovaNativePlugin.installed = function () {
  561. var isAvailable = checkAvailability(this.pluginRef) === true;
  562. return isAvailable;
  563. };
  564. /**
  565. * Returns the original plugin object
  566. */
  567. AwesomeCordovaNativePlugin.getPlugin = function () {
  568. if (typeof window !== 'undefined') {
  569. return get(window, this.pluginRef);
  570. }
  571. return null;
  572. };
  573. /**
  574. * Returns the plugin's name
  575. */
  576. AwesomeCordovaNativePlugin.getPluginName = function () {
  577. var pluginName = this.pluginName;
  578. return pluginName;
  579. };
  580. /**
  581. * Returns the plugin's reference
  582. */
  583. AwesomeCordovaNativePlugin.getPluginRef = function () {
  584. var pluginRef = this.pluginRef;
  585. return pluginRef;
  586. };
  587. /**
  588. * Returns the plugin's install name
  589. */
  590. AwesomeCordovaNativePlugin.getPluginInstallName = function () {
  591. var plugin = this.plugin;
  592. return plugin;
  593. };
  594. /**
  595. * Returns the plugin's supported platforms
  596. */
  597. AwesomeCordovaNativePlugin.getSupportedPlatforms = function () {
  598. var platform = this.platforms;
  599. return platform;
  600. };
  601. AwesomeCordovaNativePlugin.pluginName = '';
  602. AwesomeCordovaNativePlugin.pluginRef = '';
  603. AwesomeCordovaNativePlugin.plugin = '';
  604. AwesomeCordovaNativePlugin.repo = '';
  605. AwesomeCordovaNativePlugin.platforms = [];
  606. AwesomeCordovaNativePlugin.install = '';
  607. return AwesomeCordovaNativePlugin;
  608. }());
  609. /**
  610. * @param pluginObj
  611. * @param methodName
  612. * @param config
  613. * @param args
  614. */
  615. function cordova(pluginObj, methodName, config, args) {
  616. return wrap(pluginObj, methodName, config).apply(this, args);
  617. }
  618. /**
  619. * @param pluginObj
  620. * @param methodName
  621. */
  622. function overrideFunction(pluginObj, methodName) {
  623. return new rxjs.Observable(function (observer) {
  624. var availabilityCheck = checkAvailability(pluginObj, methodName);
  625. if (availabilityCheck === true) {
  626. var pluginInstance_1 = getPlugin(pluginObj.constructor.getPluginRef());
  627. pluginInstance_1[methodName] = observer.next.bind(observer);
  628. return function () { return (pluginInstance_1[methodName] = function () { }); };
  629. }
  630. else {
  631. observer.error(availabilityCheck);
  632. observer.complete();
  633. }
  634. });
  635. }
  636. /**
  637. * @param pluginObj
  638. * @param methodName
  639. * @param args
  640. */
  641. function cordovaFunctionOverride(pluginObj, methodName, args) {
  642. return overrideFunction(pluginObj, methodName);
  643. }
  644. /**
  645. * @param pluginObj
  646. * @param methodName
  647. * @param config
  648. * @param args
  649. */
  650. function cordovaInstance(pluginObj, methodName, config, args) {
  651. args = Array.from(args);
  652. return wrapInstance(pluginObj, methodName, config).apply(this, args);
  653. }
  654. /**
  655. * @param pluginObj
  656. * @param key
  657. */
  658. function cordovaPropertyGet(pluginObj, key) {
  659. if (checkAvailability(pluginObj, key) === true) {
  660. return getPlugin(pluginObj.constructor.getPluginRef())[key];
  661. }
  662. return null;
  663. }
  664. /**
  665. * @param pluginObj
  666. * @param key
  667. * @param value
  668. */
  669. function cordovaPropertySet(pluginObj, key, value) {
  670. if (checkAvailability(pluginObj, key) === true) {
  671. getPlugin(pluginObj.constructor.getPluginRef())[key] = value;
  672. }
  673. }
  674. /**
  675. * @param pluginObj
  676. * @param key
  677. */
  678. function instancePropertyGet(pluginObj, key) {
  679. if (pluginObj._objectInstance && pluginObj._objectInstance[key]) {
  680. return pluginObj._objectInstance[key];
  681. }
  682. return null;
  683. }
  684. /**
  685. * @param pluginObj
  686. * @param key
  687. * @param value
  688. */
  689. function instancePropertySet(pluginObj, key, value) {
  690. if (pluginObj._objectInstance) {
  691. pluginObj._objectInstance[key] = value;
  692. }
  693. }
  694. checkReady();
  695. exports.AwesomeCordovaNativePlugin = AwesomeCordovaNativePlugin;
  696. exports.checkAvailability = checkAvailability;
  697. exports.cordova = cordova;
  698. exports.cordovaFunctionOverride = cordovaFunctionOverride;
  699. exports.cordovaInstance = cordovaInstance;
  700. exports.cordovaPropertyGet = cordovaPropertyGet;
  701. exports.cordovaPropertySet = cordovaPropertySet;
  702. exports.getPromise = getPromise;
  703. exports.instanceAvailability = instanceAvailability;
  704. exports.instancePropertyGet = instancePropertyGet;
  705. exports.instancePropertySet = instancePropertySet;
  706. exports.wrap = wrap;