opal/browser/storage.rb
def commit(&block)
    autosave  = @autosave
    @autosave = false
    result    = nil

    reload

    begin
      result = block.call
      save
    rescue
      reload
      raise
    ensure
      @autosave = autosave
    end

    result
  end
def commit(&block)
    autosave  = @autosave
    @autosave = false
    result    = nil

    reload

    begin
      result = block.call
      save
    rescue
      reload
      raise
    ensure
      @autosave = autosave
    end

    result
  end
Call the block between a [#reload] and [#save].