cc.fovea.cordova.purchase
Version:
Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)
49 lines (41 loc) • 1.1 kB
JavaScript
(function() {
/// ## *store.products* array ##
/// Array of all registered products
///
/// #### example
///
/// store.products[0]
store.products = [];
/// ### *store.products.push(product)*
/// Acts like the Array `push` method, but also adds
/// the product to the [byId](#byId) and [byAlias](#byAlias) objects.
store.products.push = function(p) {
Array.prototype.push.call(this, p);
this.byId[p.id] = p;
this.byAlias[p.alias] = p;
};
/// ### <a name="byId"></a>*store.products.byId* dictionary
/// Registered products indexed by their ID
///
/// #### example
///
/// store.products.byId["cc.fovea.inapp1"]
store.products.byId = {};
/// ### <a name="byAlias"></a>*store.products.byAlias* dictionary
/// Registered products indexed by their alias
///
/// #### example
///
/// store.products.byAlias["full version"]```
store.products.byAlias = {};
//
// ### *store.products.reset()*
//
// Remove all products (for testing only).
store.products.reset = function() {
while (this.length > 0)
this.shift();
this.byAlias = {};
this.byId = {};
};
})();