Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Add Toast Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pbernasconi committed Jun 11, 2014
1 parent 7980897 commit 723d4fa
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ angular.module('ngCordova.plugins', [
'ngCordova.plugins.push',
'ngCordova.plugins.spinnerDialog',
'ngCordova.plugins.pinDialog',
'ngCordova.plugins.localNotification'
'ngCordova.plugins.localNotification',
'ngCordova.plugins.toast'
]);
79 changes: 79 additions & 0 deletions src/plugins/toast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
angular.module('ngCordova.plugins.toast', [])

.factory('$cordovaToast', ['$q', function ($q) {

return {
showShortTop: function (message) {
var q = $q.defer();
window.plugins.toast.showShortTop(message, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
},

showShortCenter: function (message) {
var q = $q.defer();
window.plugins.toast.showShortCenter(message, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
},

showShortBottom: function (message) {
var q = $q.defer();
window.plugins.toast.showShortBottom(message, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
},

showLongTop: function (message) {
var q = $q.defer();
window.plugins.toast.showLongTop(message, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
},

showLongCenter: function (message) {
var q = $q.defer();
window.plugins.toast.showLongCenter(message, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
},

showLongBottom: function (message) {
var q = $q.defer();
window.plugins.toast.showLongBottom(message, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
},


show: function (message, duration, position) {
var q = $q.defer();
window.plugins.toast.show(message, duration, position, function (response) {
q.resolve(response);
}, function (error) {
q.reject(error)
})
return q.promise;
}
}

}
]);
Empty file added test/plugins/toast.spec.js
Empty file.

0 comments on commit 723d4fa

Please sign in to comment.