-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zh-cn]: add translation for
FileReaderSync()
(#20270)
- Loading branch information
1 parent
c7b4cc9
commit 5c4a232
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
files/zh-cn/web/api/filereadersync/filereadersync/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: FileReaderSync:FileReaderSync() 构造函数 | ||
slug: Web/API/FileReaderSync/FileReaderSync | ||
l10n: | ||
sourceCommit: 1dad49fff047729e8dcca313a45ccb4cc2d2526f | ||
--- | ||
|
||
{{APIRef("File API")}} {{AvailableInWorkers("worker_except_service")}} | ||
|
||
**`FileReaderSync()`** 构造函数创建一个新的 {{domxref("FileReaderSync")}} 对象。 | ||
|
||
## 语法 | ||
|
||
```js-nolint | ||
new FileReaderSync() | ||
``` | ||
|
||
### 参数 | ||
|
||
无。 | ||
|
||
## 示例 | ||
|
||
以下代码片段显示了使用 `FileReaderSync()` 构造函数创建 [`FileReaderSync`](/zh-CN/docs/Web/API/FileReaderSync) 对象以及该对象后续的用法: | ||
|
||
```js | ||
function readFile(blob) { | ||
const reader = new FileReaderSync(); | ||
postMessage(reader.readAsDataURL(blob)); | ||
} | ||
``` | ||
|
||
> **备注:** 此代码段必须在 {{domxref("Worker")}} 内部使用,因为同步接口不能在主线程上使用。 | ||
## 规范 | ||
|
||
{{Specifications}} | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} |