From MozillaZine Knowledge Base

Revision as of 01:11, 9 March 2005; view current revision
←Older revision | Newer revision→

asqueella's suggestions

I'd like to get point-by-point agree/disagree answer below from interested parties (grimholtz?), add long answers as subsections.

  • rename top-level ids -> FileIO2, DirIO2 to avoid conflicts with older code.
  • change Components.classes[this.dirservCID].createInstance(this.propsIID) -> getService (it is a service).
  • uncomment this ((?) I don't really see why that's commented): // data += uniConv.Finish();
  • remove DirIO.join/DirIO.split. [IO article] has example for converting native path to URI and vice versa. I don't know how join/split can be used also, and this is not very clean XP code (hard-coding '\' for windows only doesn't seem smart).
  • rewrite FileIO.path()
  • move return false statements out of catch blocks
  • add dump() statements instead of // foobar!
  • personal: I would like the *CID/*IID members to be removed. I like the idea of creating wrappers for getService/createInstance, see below. This makes code much more readable IMO.
  createInstance: function(aCID, aIID) {
    return Components.classes[""+aCID]

  getService: function(aCID, aIID) {
    return Components.classes[""+aCID]
  • replace tab symbols with two-spaces. It is too wide for my 1024x768 screen now.
  • move examples from code to a separate section, add a link to io.js to the code.

me thinks about creating his own thin wrapper (like this for prefs) for file io...