filer/examples/refactoring-test.html

46 lines
802 B
HTML
Raw Normal View History

2013-05-30 18:57:33 +00:00
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="stdout"></div>
</body>
<script src="../lib/require.js"></script>
<script>
require.config({
baseUrl: "../lib",
paths: {
"src": "../src"
}
});
2013-05-31 01:38:44 +00:00
require(["src/file-system"], function(IDBFS) {
2013-05-30 18:57:33 +00:00
var flags = 'FORMAT';
//var flags = undefined;
var fs = new IDBFS.FileSystem('test', flags);
fs.promise.otherwise(
function(error) {
console.error(error);
}
);
function make_tmp_directory() {
return fs.mkdir('/tmp');
};
2013-05-30 22:49:31 +00:00
function remove_tmp_directory() {
return fs.rmdir('/tmp');
};
fs.promise.then(make_tmp_directory)
.then(remove_tmp_directory)
.then(function() { console.log('done'); })
2013-05-30 23:07:21 +00:00
.otherwise(function(error) { console.error(error.stack); });
2013-05-30 18:57:33 +00:00
});
</script>
</html>