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

Commit 9745214

Browse files
author
arno chauveau
committed
added commonjs package manager support
1 parent 6463412 commit 9745214

File tree

5 files changed

+273
-258
lines changed

5 files changed

+273
-258
lines changed

demo/www/lib/ngCordova/dist/ng-cordova.js

Lines changed: 131 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
*/
77
(function(){
88

9+
/* commonjs package manager support (eg componentjs) */
10+
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){
11+
module.exports = 'ngCordova';
12+
}
13+
914
angular.module('ngCordova', [
1015
'ngCordova.plugins'
1116
]);
@@ -15,11 +20,11 @@ angular.module('ngCordova', [
1520

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

18-
.factory('$cordova3DTouch', ['$q', function($q) {
23+
.factory('$cordova3DTouch', ['$q', function ($q) {
1924
var quickActions = [];
2025
var quickActionHandler = {};
2126

22-
var createQuickActionHandler = function(quickActionHandler) {
27+
var createQuickActionHandler = function (quickActionHandler) {
2328
return function (payload) {
2429
for (var key in quickActionHandler) {
2530
if (payload.type === key) {
@@ -64,7 +69,7 @@ angular.module('ngCordova.plugins.3dtouch', [])
6469
* @param function callback (optional)
6570
* @return promise
6671
*/
67-
addQuickAction: function(type, title, iconType, iconTemplate, subtitle, callback) {
72+
addQuickAction: function (type, title, iconType, iconTemplate, subtitle, callback) {
6873
var deferred = $q.defer();
6974

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

84-
this.isAvailable().then(function() {
89+
this.isAvailable().then(function () {
8590
quickActions.push(quickAction);
8691
quickActionHandler[type] = callback;
8792
window.ThreeDeeTouch.configureQuickActions(quickActions);
8893
window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
8994
deferred.resolve(quickActions);
9095
},
91-
function(err) {
96+
function (err) {
9297
deferred.reject(err);
9398
});
9499

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

108-
this.isAvailable().then(function() {
113+
this.isAvailable().then(function () {
109114
quickActionHandler[type] = callback;
110115
window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
111116
deferred.resolve(true);
112117
},
113-
function(err) {
118+
function (err) {
114119
deferred.reject(err);
115120
});
116121

@@ -122,14 +127,14 @@ angular.module('ngCordova.plugins.3dtouch', [])
122127
*
123128
* @return bool
124129
*/
125-
enableLinkPreview: function() {
130+
enableLinkPreview: function () {
126131
var deferred = $q.defer();
127132

128-
this.isAvailable().then(function() {
133+
this.isAvailable().then(function () {
129134
window.ThreeDeeTouch.enableLinkPreview();
130135
deferred.resolve(true);
131136
},
132-
function(err) {
137+
function (err) {
133138
deferred.reject(err);
134139
});
135140

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

148-
this.isAvailable().then(function() {
153+
this.isAvailable().then(function () {
149154
window.ThreeDeeTouch.watchForceTouches(callback);
150155
deferred.resolve(true);
151156
},
152-
function(err) {
157+
function (err) {
153158
deferred.reject(err);
154159
});
155160

@@ -5314,112 +5319,6 @@ angular.module('ngCordova.plugins.localNotification', [])
53145319
};
53155320
}]);
53165321

5317-
// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-mmedia.git
5318-
// link : https://github.com/floatinghotpot/cordova-plugin-mmedia
5319-
5320-
angular.module('ngCordova.plugins.mMediaAds', [])
5321-
5322-
.factory('$cordovaMMediaAds', ['$q', '$window', function ($q, $window) {
5323-
5324-
return {
5325-
setOptions: function (options) {
5326-
var d = $q.defer();
5327-
5328-
$window.mMedia.setOptions(options, function () {
5329-
d.resolve();
5330-
}, function () {
5331-
d.reject();
5332-
});
5333-
5334-
return d.promise;
5335-
},
5336-
5337-
createBanner: function (options) {
5338-
var d = $q.defer();
5339-
5340-
$window.mMedia.createBanner(options, function () {
5341-
d.resolve();
5342-
}, function () {
5343-
d.reject();
5344-
});
5345-
5346-
return d.promise;
5347-
},
5348-
5349-
removeBanner: function () {
5350-
var d = $q.defer();
5351-
5352-
$window.mMedia.removeBanner(function () {
5353-
d.resolve();
5354-
}, function () {
5355-
d.reject();
5356-
});
5357-
5358-
return d.promise;
5359-
},
5360-
5361-
showBanner: function (position) {
5362-
var d = $q.defer();
5363-
5364-
$window.mMedia.showBanner(position, function () {
5365-
d.resolve();
5366-
}, function () {
5367-
d.reject();
5368-
});
5369-
5370-
return d.promise;
5371-
},
5372-
5373-
showBannerAtXY: function (x, y) {
5374-
var d = $q.defer();
5375-
5376-
$window.mMedia.showBannerAtXY(x, y, function () {
5377-
d.resolve();
5378-
}, function () {
5379-
d.reject();
5380-
});
5381-
5382-
return d.promise;
5383-
},
5384-
5385-
hideBanner: function () {
5386-
var d = $q.defer();
5387-
5388-
$window.mMedia.hideBanner(function () {
5389-
d.resolve();
5390-
}, function () {
5391-
d.reject();
5392-
});
5393-
5394-
return d.promise;
5395-
},
5396-
5397-
prepareInterstitial: function (options) {
5398-
var d = $q.defer();
5399-
5400-
$window.mMedia.prepareInterstitial(options, function () {
5401-
d.resolve();
5402-
}, function () {
5403-
d.reject();
5404-
});
5405-
5406-
return d.promise;
5407-
},
5408-
5409-
showInterstitial: function () {
5410-
var d = $q.defer();
5411-
5412-
$window.mMedia.showInterstitial(function () {
5413-
d.resolve();
5414-
}, function () {
5415-
d.reject();
5416-
});
5417-
5418-
return d.promise;
5419-
}
5420-
};
5421-
}]);
5422-
54235322
// install : cordova plugin add cordova-plugin-media
54245323
// link : https://github.com/apache/cordova-plugin-media
54255324

@@ -5563,6 +5462,112 @@ angular.module('ngCordova.plugins.media', [])
55635462
};
55645463
}]);
55655464

5465+
// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-mmedia.git
5466+
// link : https://github.com/floatinghotpot/cordova-plugin-mmedia
5467+
5468+
angular.module('ngCordova.plugins.mMediaAds', [])
5469+
5470+
.factory('$cordovaMMediaAds', ['$q', '$window', function ($q, $window) {
5471+
5472+
return {
5473+
setOptions: function (options) {
5474+
var d = $q.defer();
5475+
5476+
$window.mMedia.setOptions(options, function () {
5477+
d.resolve();
5478+
}, function () {
5479+
d.reject();
5480+
});
5481+
5482+
return d.promise;
5483+
},
5484+
5485+
createBanner: function (options) {
5486+
var d = $q.defer();
5487+
5488+
$window.mMedia.createBanner(options, function () {
5489+
d.resolve();
5490+
}, function () {
5491+
d.reject();
5492+
});
5493+
5494+
return d.promise;
5495+
},
5496+
5497+
removeBanner: function () {
5498+
var d = $q.defer();
5499+
5500+
$window.mMedia.removeBanner(function () {
5501+
d.resolve();
5502+
}, function () {
5503+
d.reject();
5504+
});
5505+
5506+
return d.promise;
5507+
},
5508+
5509+
showBanner: function (position) {
5510+
var d = $q.defer();
5511+
5512+
$window.mMedia.showBanner(position, function () {
5513+
d.resolve();
5514+
}, function () {
5515+
d.reject();
5516+
});
5517+
5518+
return d.promise;
5519+
},
5520+
5521+
showBannerAtXY: function (x, y) {
5522+
var d = $q.defer();
5523+
5524+
$window.mMedia.showBannerAtXY(x, y, function () {
5525+
d.resolve();
5526+
}, function () {
5527+
d.reject();
5528+
});
5529+
5530+
return d.promise;
5531+
},
5532+
5533+
hideBanner: function () {
5534+
var d = $q.defer();
5535+
5536+
$window.mMedia.hideBanner(function () {
5537+
d.resolve();
5538+
}, function () {
5539+
d.reject();
5540+
});
5541+
5542+
return d.promise;
5543+
},
5544+
5545+
prepareInterstitial: function (options) {
5546+
var d = $q.defer();
5547+
5548+
$window.mMedia.prepareInterstitial(options, function () {
5549+
d.resolve();
5550+
}, function () {
5551+
d.reject();
5552+
});
5553+
5554+
return d.promise;
5555+
},
5556+
5557+
showInterstitial: function () {
5558+
var d = $q.defer();
5559+
5560+
$window.mMedia.showInterstitial(function () {
5561+
d.resolve();
5562+
}, function () {
5563+
d.reject();
5564+
});
5565+
5566+
return d.promise;
5567+
}
5568+
};
5569+
}]);
5570+
55665571
// install : cordova plugin add https://github.com/floatinghotpot/cordova-mobfox-pro.git
55675572
// link : https://github.com/floatinghotpot/cordova-mobfox-pro
55685573

@@ -6556,7 +6561,7 @@ angular.module('ngCordova.plugins.serial', [])
65566561
return q.promise;
65576562
};
65586563

6559-
serialService.open = function(options) {
6564+
serialService.open = function (options) {
65606565
var q = $q.defer();
65616566

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

6571-
serialService.write = function(data) {
6576+
serialService.write = function (data) {
65726577
var q = $q.defer();
65736578

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

6583-
serialService.writeHex = function(data) {
6588+
serialService.writeHex = function (data) {
65846589
var q = $q.defer();
65856590

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

6595-
serialService.read = function() {
6600+
serialService.read = function () {
65966601
var q = $q.defer();
65976602

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

6608-
serialService.registerReadCallback = function(successCallback, errorCallback) {
6613+
serialService.registerReadCallback = function (successCallback, errorCallback) {
66096614
serial.registerReadCallback(function success(buffer) {
66106615
var view = new Uint8Array(buffer);
66116616
successCallback(view);
66126617
}, errorCallback);
66136618
};
66146619

6615-
serialService.close = function() {
6620+
serialService.close = function () {
66166621
var q = $q.defer();
66176622

66186623
serial.close(function success() {

demo/www/lib/ngCordova/dist/ng-cordova.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)