fluid infusion uploader - postParams and meta info

Aaron Brown aaron at thebrownproject.com
Tue Mar 31 20:35:40 UTC 2009


Colin Clark wrote:
> This should be a pretty easy fix for Infusion 1.1. Do you think an API
> like this is sufficient, where you can set the contents of the
> postParams object to whatever you need?
> 
> uploader.setPostParams(paramsObject)
> 
> Or would you prefer methods for adding, removing, and resetting as well?
> 
> uploader.addPostParams(paramsObject || Key / Value)
> uploader.removePostParams(paramsObject || String)
> uploader.resetPostParams()

Hm.  Here's My Humble Opinion:

Add setPostParams and addPostParam to the API.

That said, we all have our own personal toolboxes of programming
structures that we favor, so I can't say those two are sufficient for
everyone.

resetParams:  I would just say setPostParams({}) instead.
removePostParam:  I don't forsee ever using this.  Your mileage may vary.

Also, "addPostParam" is perhaps a misnomer since in swfupload.js it's
just a hash value assignment operation, so it will update the value if
the key exists, or add the key/value if not.  Note that, if I remember
the code correctly, the swfupload setPostParams function does a complete
replacement of the existing post_params hash with whatever you give it.
 In that sense it is *not* like a normal hash assignment - the new keys
won't be mixed in with the old, the old key/values will be erased.

Not that I'm recommending another semantics discussion thread for this,
but when fluid provides public accessors to the underlying swfupload
functions, it may be worth using some more fluid-like naming scheme
instead of borrowing directly from the existing functions.

 - Aaron

-- 
Aaron Brown :: aaron at thebrownproject.com :: www.thebrownproject.com




More information about the fluid-work mailing list