Files
sdk/tools/dom/templates/html/impl/impl_DirectoryReader.darttemplate
T
Srujan Gaddam 01642c2122 [dart:html] Add different bindings for FileSystem APIs
Closes https://github.com/dart-lang/sdk/issues/45036

The FileSystem API has different bindings for different browsers,
and the values are all taken directly from the MDN:
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API
Along with this, some APIs that need to expose these bindings are modified to
expose all possible bindings.

Change-Id: I18ce6d1208349eb9d5bd9d802d17dda1ddae2dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225323
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-12-23 00:11:03 +00:00

37 lines
1.2 KiB
Plaintext

// Copyright (c) 2013, 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.
part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
$!MEMBERS
Future<List<Entry>> readEntries() {
var completer = new Completer<List<Entry>>();
_readEntries((values) {
values.forEach((value) {
applyExtension('Entry', value);
applyExtension('webkitFileSystemEntry', value);
applyExtension('FileSystemEntry', value);
Entry entry = value as Entry;
if (entry.isFile$NULLASSERT) {
applyExtension('FileEntry', entry);
applyExtension('webkitFileSystemFileEntry', entry);
applyExtension('FileSystemFileEntry', entry);
} else if (entry.isDirectory$NULLASSERT) {
applyExtension('DirectoryEntry', entry);
applyExtension('webkitFileSystemDirectoryEntry', entry);
applyExtension('FileSystemDirectoryEntry', entry);
}
});
completer.complete(new List<Entry>.from(values));
}, (error) {
completer.completeError(error);
});
return completer.future;
}
}