34 lines
791 B
JavaScript
34 lines
791 B
JavaScript
'use strict';
|
|
|
|
angular.module('copayApp.services').service('addonManager', function (lodash) {
|
|
var addons = [];
|
|
|
|
this.registerAddon = function (addonSpec) {
|
|
addons.push(addonSpec);
|
|
};
|
|
|
|
this.addonMenuItems = function () {
|
|
return lodash.map(addons, function (addonSpec) {
|
|
return addonSpec.menuItem;
|
|
});
|
|
};
|
|
|
|
this.addonViews = function () {
|
|
return lodash.map(addons, function (addonSpec) {
|
|
return addonSpec.view;
|
|
});
|
|
};
|
|
|
|
this.formatPendingTxp = function (txp) {
|
|
lodash.each(addons, function (addon) {
|
|
if (addon.formatPendingTxp) {
|
|
addon.formatPendingTxp(txp);
|
|
}
|
|
});
|
|
};
|
|
|
|
this.txTemplateUrl = function() {
|
|
var addon = lodash.find(addons, 'txTemplateUrl');
|
|
return addon ? addon.txTemplateUrl() : null;
|
|
}
|
|
});
|