Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #34985

Re: Blob write complete event ?

Newsgroups comp.lang.javascript
Date 2018-05-05 19:14 -0700
References <t4dhedt5r6i7mu2vag7jjanpl2gcutmogv@4ax.com>
Message-ID <0f01a2fa-2da1-40d6-ad9c-a262f86c85cf@googlegroups.com> (permalink)
Subject Re: Blob write complete event ?
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


Dr....@nyc.rr.com wrote:
> I can not find the write local file complete event for a blob which is just
> as necessary as the read complete event "onload" .
> 
> I am running in my browser and within the security features and locally.
> Getting the file list, reading each file, editing and rewriting are working
> well.  I have taken the read/write stuff from this example: <<
> thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip/
> >> with minor modifications.
> 
> [...]
> 
> It was trivial to add another function call to start the editing from the
> ‘onload event’ handler which assures the read is complete.  I would like to
> have the same assurance for the write.  I could just add a short delay
> (1-2second) but that not "clean".
> 
> Unfortunately << developer.mozilla.org/en-US/docs/Web/Events >> was not
> helpful for this.
> 
> I did notice mention of some other API file methods but they were mention
> as obsolete or to come.


I wonder if this is even the right way to think about it or approach it. If I was to build a in-browser file-editor I would approach these features like this:

1. Open File
2. Save File
3. Download File

1- Opening a file happens the usual way with <input type="file"> and the FileReader API
2- The file is saved to IndexDB
3- A prompt is given for download using the method you're describing above.

In case #2 you would be able to listen for completion and have confidence that the file saved properly

In case #3 you don't care as it's not being used in by application (like auto-save). Treat this last case like "Export" instead of "Save"

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Blob write complete event ? Dr.Kral@nyc.rr.com - 2018-05-01 14:49 -0400
  Re: Blob write complete event ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-05-05 19:14 -0700
    Re: Blob write complete event ? Julio Di Egidio <julio@diegidio.name> - 2018-05-06 03:50 -0700
      Re: Blob write complete event ? Dr.Kral@nyc.rr.com - 2018-05-06 11:08 -0400
        Re: Blob write complete event ? Julio Di Egidio <julio@diegidio.name> - 2018-05-06 11:36 -0700
      Re: Blob write complete event ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-05-06 10:26 -0700
        Re: Blob write complete event ? Julio Di Egidio <julio@diegidio.name> - 2018-05-06 11:33 -0700
          Re: Blob write complete event ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-05-06 12:08 -0700
    Re: Blob write complete event ? Dr.Kral@nyc.rr.com - 2018-05-06 11:02 -0400
      Re: Blob write complete event ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-05-06 10:56 -0700

csiph-web