You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by tr...@apache.org on 2016/01/08 23:05:47 UTC
[2/3] mac commit: Update CDVBridge.m
Update CDVBridge.m
We don't need them anymore.. This closes #29
Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/dd620c9b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/dd620c9b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/dd620c9b
Branch: refs/heads/master
Commit: dd620c9b913ec3cc909e4d41369a10c9fcf9b260
Parents: 5ca3a7c
Author: Sahil Bhardwaj <sa...@gmail.com>
Authored: Tue Dec 22 12:35:02 2015 +0530
Committer: Tobias Bocanegra <tr...@adobe.com>
Committed: Fri Jan 8 13:05:10 2016 -0800
----------------------------------------------------------------------
CordovaLib/CordovaLib/Classes/CDVBridge.m | 42 --------------------------
1 file changed, 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/dd620c9b/CordovaLib/CordovaLib/Classes/CDVBridge.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/CDVBridge.m b/CordovaLib/CordovaLib/Classes/CDVBridge.m
index aafb541..5a67d24 100644
--- a/CordovaLib/CordovaLib/Classes/CDVBridge.m
+++ b/CordovaLib/CordovaLib/Classes/CDVBridge.m
@@ -41,48 +41,6 @@
return [result boolValue];
}
-- (NSDictionary*) convertWebScriptObjectToNSDictionary:(WebScriptObject*) webScriptObject {
- // Assumption: webScriptObject has already been tested using isDictionary:
-
- id win = [self.webView windowScriptObject];
-
- WebScriptObject* util = [win valueForKey:@"CordovaBridgeUtil"];
- WebScriptObject* keysObject = [util callWebScriptMethod:@"getDictionaryKeys" withArguments:@[webScriptObject]];
- NSArray* keys = [self convertWebScriptObjectToNSArray:keysObject];
- NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithCapacity:[keys count]];
-
- NSEnumerator* enumerator = [keys objectEnumerator];
- id key;
- while ((key = enumerator.nextObject)) {
- dict[key] = [webScriptObject valueForKey:key];
- }
-
- return dict;
-}
-
-- (NSArray*) convertWebScriptObjectToNSArray:(WebScriptObject*) webScriptObject {
- // Assumption: webScriptObject has already been tested using isArray:
-
- NSUInteger count = [[webScriptObject valueForKey:@"length"] unsignedIntegerValue];
- NSMutableArray* a = [NSMutableArray array];
- for (unsigned i = 0; i < count; i++) {
- id item = [webScriptObject webScriptValueAtIndex:i];
- if (!item) {
- [a addObject:[NSNull null]];
- } else if ([item isKindOfClass:[WebScriptObject class]]) {
- if ([self isArray:item]) {
- [a addObject:[self convertWebScriptObjectToNSArray:item]];
- } else if ([self isDictionary:item]) {
- [a addObject:[self convertWebScriptObjectToNSDictionary:item]];
- };
- } else {
- [a addObject:item];
- }
- }
-
- return a;
-}
-
- (void) registerJavaScriptHelpers {
NSString* cordovaBridgeUtil = @"var CordovaBridgeUtil = {};";
NSString* isArray = [NSString stringWithFormat:@"CordovaBridgeUtil.isArray = function(obj) { return obj.constructor == Array; };"];
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org