cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kerri Shotts (JIRA)" <>
Subject [jira] [Commented] (CB-12515) returns [object Object] instead of [object File]
Date Wed, 01 Mar 2017 17:56:45 GMT


Kerri Shotts commented on CB-12515:

I just caught on that you're using a third-party JS Library for uploading. ES5 offers no mechanism
for changing the internal class property, which is what using {{}}
references. As such, when Cordova creates a File class and then instantiates an object from
it, the internal class remains "Object", and there's no way to override that. ES2015+ has
possibilities, but Cordova must remain compatible with ES5 for now.

I would suggest filing an issue with the third-party plugin indicating that their type checking
fails in this case. Personally, I'd prefer some duck typing here: that is, check if the passed
object has the properties/methods you expect, and if it does, it's probably a File. 

Alternatively, consider using other wrappers that don't rely on this kind of type checking,
or interface with the File & File Transfer plugins directly.

Since there's nothing we can do, I'm closing the issue.

> returns [object Object] instead of [object File]
> -------------------------------------------------------------------------------------
>                 Key: CB-12515
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>            Reporter: Alexander Broekhuis
> I'm trying to use the File plugin in combination with FineUploader. FineUploader uses
the File API and tests if a passed in object is a file using the following call:
> === "[object File]"
> But the File retrieved from a FileEntry using entry.file(function(file) { ... }); is
not seen as a file since the returns [object Object].

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message