filer/examples/refactoring-test.html

46 lines
794 B
HTML

<!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"
}
});
require(["src/fs2"], function(IDBFS) {
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');
};
function remove_tmp_directory() {
return fs.rmdir('/tmp');
};
fs.promise.then(make_tmp_directory)
.then(remove_tmp_directory)
.then(function() { console.log('done'); })
.otherwise(function(error) { console.error(error.stack); });
});
</script>
</html>