Skip to content

Commit 9f350ac

Browse files
committed
Remove underscore dependency
1 parent 69da17c commit 9f350ac

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

index.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
*
55
* @auther Hazem Khaled <hazem.khaled@gmail.com>
66
*/
7-
var Alloy = require("alloy")
8-
, _ = require("alloy/underscore")._
9-
;
10-
117
var ANDROID = Ti.Platform.name === 'android',
128
IOS = !ANDROID && (Ti.Platform.name === 'iPhone OS');
139

@@ -30,26 +26,27 @@ TiPush.prototype.registerDevice = function(_prams) {
3026
pnOptions = _prams.pnOptions,
3127
extraOptions = _prams.extraOptions || {};
3228

33-
_.each(extraOptions, function(value, key){
34-
that['' + key + ''] = value;
35-
});
29+
for (var key in extraOptions) {
30+
that[key] = extraOptions[key];
31+
}
3632

3733
function deviceTokenSuccess(e) {
3834
if (ANDROID) {
39-
console.log('[TiPush] Device Token:', e.registrationId);
35+
Ti.API.debug('[TiPush] Device Token:', e.registrationId);
4036
token = e.registrationId;
4137
} else if (IOS) {
42-
console.log('[TiPush] Device Token:', e.deviceToken);
38+
Ti.API.debug('[TiPush] Device Token:', e.deviceToken);
4339
token = e.deviceToken;
4440
}
4541
that.token = token;
4642

4743
var uploadParams = {};
48-
_.each(that, function(value, key){
49-
if(key != "backendUrl" && key != "getToken" && key != "registerDevice"){
50-
uploadParams['' + key + ''] = value;
44+
45+
for (var key in that) {
46+
if (['backendUrl', 'getToken', 'registerDevice'].indexOf(key) === -1) {
47+
uploadParams[key] = that[key];
5148
}
52-
});
49+
}
5350

5451
var xhr = Ti.Network.createHTTPClient({
5552
onload: function() {

0 commit comments

Comments
 (0)