blob: 637fa7a5d9523c91193c83338f1c19a8180946ca [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library request_cache;
import 'dart:html';
/** File system implementation using HTML5's Web Storage. */
class HttpRequestCache {
final Storage storage;
HttpRequestCache() : storage = window.sessionStorage;
String readAll(String filename) {
String response = storage[filename];
if (response == null) {
HttpRequest xr = new HttpRequest();"GET", filename, false);
response = xr.responseText;
storage[filename] = response;
return response;