cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Re: ArrayBuffer support for Cordova OS X ?
Date Thu, 04 Jul 2013 06:05:32 GMT
You should add a feature request - surprised it didn't get "converted"
using our mechanism here though:
https://github.com/apache/cordova-js/blob/master/lib/osx/exec.js#L70



On Mon, Jul 1, 2013 at 4:20 PM, Tyler Wilson <twilson@pulse-robotics.com>wrote:

> Good day,
>
> I just signed up to the mailing list, though I have been a very happy user
> of Cordova for a while now. I am working on a plugin for Cordova, and have
> thus far developed on iOS, and everything is fine. I started a new project
> with Cordova OS X, and ported some code over. But it was not working right.
> Took a long while to figure out what was happening. The iOS version has
> support for passing ArrayBuffer objects from the JS to native side (as
> NSData). This is a _very_ useful feature. So I had assumed it would work
> with the OS X version. I was wrong of course.
>
> I tracked it down to this code in CDVBridge.m:
>
> - (NSArray WebScriptObject*)webScriptObject
> {
>     // Assumption: webScriptObject has already been tested using isArray:
>
>     NSUInteger count = [[webScriptObject valueForKey:@"length"]
> integerValue];
>     NSMutableArray *a = [NSMutableArray array];
>     for (unsigned i = 0; i < count; i++) {
>         id item = [webScriptObject webScriptValueAtIndex:i];
>         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;
> }
>
> The ArrayBuffer object isKindOfClass WebScriptObject, but it is neither an
> Array or a Dictionary, so it gets dropped here.
>
> Any chance on a patch to make this work? I am a programmer, but not
> familiar enough with the Cordova internals and/or the WebScript area to
> know the proper check and conversion to put here.
>
> Thank you,
> Tyler

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message