This should be
api.attachWidgetAction('post-menu', 'downloadFile', function() {
Example to compare it to