diff options
Diffstat (limited to 'js/service/attachmentservice.js')
-rw-r--r-- | js/service/attachmentservice.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/js/service/attachmentservice.js b/js/service/attachmentservice.js index a231e9289..0d21bdfa3 100644 --- a/js/service/attachmentservice.js +++ b/js/service/attachmentservice.js @@ -25,6 +25,7 @@ define(function(require) { var Radio = require('radio'); Radio.message.reply('save:cloud', saveToFiles); + Radio.message.reply('attachment:download', downloadAttachment); /** * @param {Account} account @@ -63,4 +64,19 @@ define(function(require) { return defer.promise(); } + function downloadAttachment(url) { + var defer = $.Deferred(); + + $.ajax(url, { + success: function(data) { + defer.resolve(data); + }, + error: function() { + defer.reject(); + } + }); + + return defer.promise(); + } + }); |