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

Commit

Permalink
added commonjs package manager support
Browse files Browse the repository at this point in the history
  • Loading branch information
arno chauveau committed Oct 26, 2016
1 parent 6463412 commit 9745214
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 258 deletions.
257 changes: 131 additions & 126 deletions demo/www/lib/ngCordova/dist/ng-cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*/
(function(){

/* commonjs package manager support (eg componentjs) */
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
module.exports = 'ngCordova';
}

angular.module('ngCordova', [
'ngCordova.plugins'
]);
Expand All @@ -15,11 +20,11 @@ angular.module('ngCordova', [

angular.module('ngCordova.plugins.3dtouch', [])

.factory('$cordova3DTouch', ['$q', function($q) {
.factory('$cordova3DTouch', ['$q', function ($q) {
var quickActions = [];
var quickActionHandler = {};

var createQuickActionHandler = function(quickActionHandler) {
var createQuickActionHandler = function (quickActionHandler) {
return function (payload) {
for (var key in quickActionHandler) {
if (payload.type === key) {
Expand Down Expand Up @@ -64,7 +69,7 @@ angular.module('ngCordova.plugins.3dtouch', [])
* @param function callback (optional)
* @return promise
*/
addQuickAction: function(type, title, iconType, iconTemplate, subtitle, callback) {
addQuickAction: function (type, title, iconType, iconTemplate, subtitle, callback) {
var deferred = $q.defer();

var quickAction = {
Expand All @@ -81,14 +86,14 @@ angular.module('ngCordova.plugins.3dtouch', [])
quickAction.iconTemplate = iconTemplate;
}

this.isAvailable().then(function() {
this.isAvailable().then(function () {
quickActions.push(quickAction);
quickActionHandler[type] = callback;
window.ThreeDeeTouch.configureQuickActions(quickActions);
window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
deferred.resolve(quickActions);
},
function(err) {
function (err) {
deferred.reject(err);
});

Expand All @@ -102,15 +107,15 @@ angular.module('ngCordova.plugins.3dtouch', [])
* @param function callback
* @return promise
*/
addQuickActionHandler: function(type, callback) {
addQuickActionHandler: function (type, callback) {
var deferred = $q.defer();

this.isAvailable().then(function() {
this.isAvailable().then(function () {
quickActionHandler[type] = callback;
window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
deferred.resolve(true);
},
function(err) {
function (err) {
deferred.reject(err);
});

Expand All @@ -122,14 +127,14 @@ angular.module('ngCordova.plugins.3dtouch', [])
*
* @return bool
*/
enableLinkPreview: function() {
enableLinkPreview: function () {
var deferred = $q.defer();

this.isAvailable().then(function() {
this.isAvailable().then(function () {
window.ThreeDeeTouch.enableLinkPreview();
deferred.resolve(true);
},
function(err) {
function (err) {
deferred.reject(err);
});

Expand All @@ -142,14 +147,14 @@ angular.module('ngCordova.plugins.3dtouch', [])
* @param function callback
* @return promise
*/
addForceTouchHandler: function(callback) {
addForceTouchHandler: function (callback) {
var deferred = $q.defer();

this.isAvailable().then(function() {
this.isAvailable().then(function () {
window.ThreeDeeTouch.watchForceTouches(callback);
deferred.resolve(true);
},
function(err) {
function (err) {
deferred.reject(err);
});

Expand Down Expand Up @@ -5314,112 +5319,6 @@ angular.module('ngCordova.plugins.localNotification', [])
};
}]);

// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-mmedia.git
// link : https://github.com/floatinghotpot/cordova-plugin-mmedia

angular.module('ngCordova.plugins.mMediaAds', [])

.factory('$cordovaMMediaAds', ['$q', '$window', function ($q, $window) {

return {
setOptions: function (options) {
var d = $q.defer();

$window.mMedia.setOptions(options, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

createBanner: function (options) {
var d = $q.defer();

$window.mMedia.createBanner(options, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

removeBanner: function () {
var d = $q.defer();

$window.mMedia.removeBanner(function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

showBanner: function (position) {
var d = $q.defer();

$window.mMedia.showBanner(position, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

showBannerAtXY: function (x, y) {
var d = $q.defer();

$window.mMedia.showBannerAtXY(x, y, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

hideBanner: function () {
var d = $q.defer();

$window.mMedia.hideBanner(function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

prepareInterstitial: function (options) {
var d = $q.defer();

$window.mMedia.prepareInterstitial(options, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

showInterstitial: function () {
var d = $q.defer();

$window.mMedia.showInterstitial(function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
}
};
}]);

// install : cordova plugin add cordova-plugin-media
// link : https://github.com/apache/cordova-plugin-media

Expand Down Expand Up @@ -5563,6 +5462,112 @@ angular.module('ngCordova.plugins.media', [])
};
}]);

// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-mmedia.git
// link : https://github.com/floatinghotpot/cordova-plugin-mmedia

angular.module('ngCordova.plugins.mMediaAds', [])

.factory('$cordovaMMediaAds', ['$q', '$window', function ($q, $window) {

return {
setOptions: function (options) {
var d = $q.defer();

$window.mMedia.setOptions(options, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

createBanner: function (options) {
var d = $q.defer();

$window.mMedia.createBanner(options, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

removeBanner: function () {
var d = $q.defer();

$window.mMedia.removeBanner(function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

showBanner: function (position) {
var d = $q.defer();

$window.mMedia.showBanner(position, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

showBannerAtXY: function (x, y) {
var d = $q.defer();

$window.mMedia.showBannerAtXY(x, y, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

hideBanner: function () {
var d = $q.defer();

$window.mMedia.hideBanner(function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

prepareInterstitial: function (options) {
var d = $q.defer();

$window.mMedia.prepareInterstitial(options, function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
},

showInterstitial: function () {
var d = $q.defer();

$window.mMedia.showInterstitial(function () {
d.resolve();
}, function () {
d.reject();
});

return d.promise;
}
};
}]);

// install : cordova plugin add https://github.com/floatinghotpot/cordova-mobfox-pro.git
// link : https://github.com/floatinghotpot/cordova-mobfox-pro

Expand Down Expand Up @@ -6556,7 +6561,7 @@ angular.module('ngCordova.plugins.serial', [])
return q.promise;
};

serialService.open = function(options) {
serialService.open = function (options) {
var q = $q.defer();

serial.open(options, function success() {
Expand All @@ -6568,7 +6573,7 @@ angular.module('ngCordova.plugins.serial', [])
return q.promise;
};

serialService.write = function(data) {
serialService.write = function (data) {
var q = $q.defer();

serial.write(data, function success() {
Expand All @@ -6580,7 +6585,7 @@ angular.module('ngCordova.plugins.serial', [])
return q.promise;
};

serialService.writeHex = function(data) {
serialService.writeHex = function (data) {
var q = $q.defer();

serial.writeHex(data, function success() {
Expand All @@ -6592,7 +6597,7 @@ angular.module('ngCordova.plugins.serial', [])
return q.promise;
};

serialService.read = function() {
serialService.read = function () {
var q = $q.defer();

serial.read(function success(buffer) {
Expand All @@ -6605,14 +6610,14 @@ angular.module('ngCordova.plugins.serial', [])
return q.promise;
};

serialService.registerReadCallback = function(successCallback, errorCallback) {
serialService.registerReadCallback = function (successCallback, errorCallback) {
serial.registerReadCallback(function success(buffer) {
var view = new Uint8Array(buffer);
successCallback(view);
}, errorCallback);
};

serialService.close = function() {
serialService.close = function () {
var q = $q.defer();

serial.close(function success() {
Expand Down
6 changes: 3 additions & 3 deletions demo/www/lib/ngCordova/dist/ng-cordova.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 9745214

Please sign in to comment.