你好,来自 c#,我有点难以理解
typescript
的含义。
所以
Promise
中的 Typescript
相当于 C#
Task
,而在 C#
中我使用 await
将其展开,在后者中我使用 subscribe
访问上下文中的数据?
Promise
和Observable
之间有什么关系。
到目前为止,我了解到 Observable
类的行为类似于 System.Reactive
中的类,但是 Promise
在这个等式中来自哪里?
为什么我要为
toPromise
定义 Observable
扩展方法?我正在尝试与 C#
进行并行处理,但您无法将 IEnumerable/IObservable
转换为 Task
。
这有什么意义?我有一个流。为什么我要
await
它?该流可能没有结束。如果你await
是Observable
的一个元素,我会理解,但总的来说为什么?
Promise
和 Observable
是相同的,只是它们都是建模 async
操作的工具。
它们的主要区别在于
Observable
对事件流进行操作,因此它具有类似数组的运算符,而另一方面,当涉及 Promise
操作时,async
是一次性停止 > 一次 async
操作完成(或失败),您的Promise
已完成,无法再使用。
<div class="row">
<div class="col-xxl-3">
<div class="card">
<div class="card-body text-center">
<h6 class="card-title mb-3 flex-grow-1 text-start">Time Tracking</h6>
<div class="mb-2">
<lord-icon src="https://cdn.lordicon.com/kbtmbyzy.json" trigger="loop" colors="primary:#405189,secondary:#02a8b5" style="width:90px;height:90px"></lord-icon>
</div>
<h3 class="mb-1">9 hrs 13 min</h3>
<h5 class="fs-14 mb-4">Profile Page Structure</h5>
<div class="hstack gap-2 justify-content-center">
<button class="btn btn-danger btn-sm"><i class="ri-stop-circle-line align-bottom me-1"></i> Stop</button>
<button class="btn btn-success btn-sm"><i class="ri-play-circle-line align-bottom me-1"></i> Start</button>
</div>
</div>
</div>
<!--end card-->
<div class="card mb-3">
<div class="card-body">
<div class="mb-4">
<select class="form-control" name="choices-single-default" data-choices data-choices-search-false>
<option value="">Select Task board</option>
<option value="Unassigned">Unassigned</option>
<option value="To Do">To Do</option>
<option value="Inprogress">Inprogress</option>
<option value="In Reviews" selected>In Reviews</option>
<option value="Completed">Completed</option>
</select>
</div>
<div class="table-card">
<table class="table mb-0">
<tbody>
<tr>
<td class="fw-medium">Tasks No</td>
<td>#VLZ456</td>
</tr>
<tr>
<td class="fw-medium">Tasks Title</td>
<td>Profile Page Structure</td>
</tr>
<tr>
<td class="fw-medium">Project Name</td>
<td>Velzon - Admin Dashboard</td>
</tr>
<tr>
<td class="fw-medium">Priority</td>
<td><span class="badge bg-danger-subtle text-danger">High</span></td>
</tr>
<tr>
<td class="fw-medium">Status</td>
<td><span class="badge bg-secondary-subtle text-secondary">Inprogress</span></td>
</tr>
<tr>
<td class="fw-medium">Due Date</td>
<td>05 Jan, 2022</td>
</tr>
</tbody>
</table>
<!--end table-->
</div>
</div>
</div>
<!--end card-->
<div class="card mb-3">
<div class="card-body">
<div class="d-flex mb-3">
<h6 class="card-title mb-0 flex-grow-1">Assigned To</h6>
<div class="flex-shrink-0">
<button type="button" class="btn btn-soft-danger btn-sm" data-bs-toggle="modal" data-bs-target="#inviteMembersModal"><i class="ri-share-line me-1 align-bottom"></i> Assigned Member</button>
</div>
</div>
<ul class="list-unstyled vstack gap-3 mb-0">
<li>
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<img src="assets/images/users/avatar-10.jpg" alt="" class="avatar-xs rounded-circle">
</div>
<div class="flex-grow-1 ms-2">
<h6 class="mb-1"><a href="pages-profile.html">Tonya Noble</a></h6>
<p class="text-muted mb-0">Full Stack Developer</p>
</div>
<div class="flex-shrink-0">
<div class="dropdown">
<button class="btn btn-icon btn-sm fs-16 text-muted dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-eye-fill text-muted me-2 align-bottom"></i>View</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-star-fill text-muted me-2 align-bottom"></i>Favorite</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-5-fill text-muted me-2 align-bottom"></i>Delete</a></li>
</ul>
</div>
</div>
</div>
</li>
<li>
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<img src="assets/images/users/avatar-8.jpg" alt="" class="avatar-xs rounded-circle">
</div>
<div class="flex-grow-1 ms-2">
<h6 class="mb-1"><a href="pages-profile.html">Thomas Taylor</a></h6>
<p class="text-muted mb-0">UI/UX Designer</p>
</div>
<div class="flex-shrink-0">
<div class="dropdown">
<button class="btn btn-icon btn-sm fs-16 text-muted dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-eye-fill text-muted me-2 align-bottom"></i>View</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-star-fill text-muted me-2 align-bottom"></i>Favorite</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-5-fill text-muted me-2 align-bottom"></i>Delete</a></li>
</ul>
</div>
</div>
</div>
</li>
<li>
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
<img src="assets/images/users/avatar-2.jpg" alt="" class="avatar-xs rounded-circle">
</div>
<div class="flex-grow-1 ms-2">
<h6 class="mb-1"><a href="pages-profile.html">Nancy Martino</a></h6>
<p class="text-muted mb-0">Web Designer</p>
</div>
<div class="flex-shrink-0">
<div class="dropdown">
<button class="btn btn-icon btn-sm fs-16 text-muted dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-eye-fill text-muted me-2 align-bottom"></i>View</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-star-fill text-muted me-2 align-bottom"></i>Favorite</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-5-fill text-muted me-2 align-bottom"></i>Delete</a></li>
</ul>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<!--end card-->
<div class="card">
<div class="card-body">
<h5 class="card-title mb-3">Attachments</h5>
<div class="vstack gap-2">
<div class="border rounded border-dashed p-2">
<div class="d-flex align-items-center">
<div class="flex-shrink-0 me-3">
<div class="avatar-sm">
<div class="avatar-title bg-light text-secondary rounded fs-24">
<i class="ri-folder-zip-line"></i>
</div>
</div>
</div>
<div class="flex-grow-1 overflow-hidden">
<h5 class="fs-13 mb-1"><a href="javascript:void(0);" class="text-body text-truncate d-block">App pages.zip</a></h5>
<div>2.2MB</div>
</div>
<div class="flex-shrink-0 ms-2">
<div class="d-flex gap-1">
<button type="button" class="btn btn-icon text-muted btn-sm fs-18"><i class="ri-download-2-line"></i></button>
<div class="dropdown">
<button class="btn btn-icon text-muted btn-sm fs-18 dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> Rename</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> Delete</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="border rounded border-dashed p-2">
<div class="d-flex align-items-center">
<div class="flex-shrink-0 me-3">
<div class="avatar-sm">
<div class="avatar-title bg-light text-secondary rounded fs-24">
<i class="ri-file-ppt-2-line"></i>
</div>
</div>
</div>
<div class="flex-grow-1 overflow-hidden">
<h5 class="fs-13 mb-1"><a href="javascript:void(0);" class="text-body text-truncate d-block">Velzon admin.ppt</a></h5>
<div>2.4MB</div>
</div>
<div class="flex-shrink-0 ms-2">
<div class="d-flex gap-1">
<button type="button" class="btn btn-icon text-muted btn-sm fs-18"><i class="ri-download-2-line"></i></button>
<div class="dropdown">
<button class="btn btn-icon text-muted btn-sm fs-18 dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> Rename</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> Delete</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="border rounded border-dashed p-2">
<div class="d-flex align-items-center">
<div class="flex-shrink-0 me-3">
<div class="avatar-sm">
<div class="avatar-title bg-light text-secondary rounded fs-24">
<i class="ri-folder-zip-line"></i>
</div>
</div>
</div>
<div class="flex-grow-1 overflow-hidden">
<h5 class="fs-13 mb-1"><a href="javascript:void(0);" class="text-body text-truncate d-block">Images.zip</a></h5>
<div>1.2MB</div>
</div>
<div class="flex-shrink-0 ms-2">
<div class="d-flex gap-1">
<button type="button" class="btn btn-icon text-muted btn-sm fs-18"><i class="ri-download-2-line"></i></button>
<div class="dropdown">
<button class="btn btn-icon text-muted btn-sm fs-18 dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-fill"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> Rename</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> Delete</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="mt-2 text-center">
<button type="button" class="btn btn-success">View more</button>
</div>
</div>
</div>
</div>
<!--end card-->
</div>
<!---end col-->
<div class="col-xxl-9">
<div class="card">
<div class="card-body">
<div class="text-muted">
<h6 class="mb-3 fw-semibold text-uppercase">Summary</h6>
<p>It will be as simple as occidental in fact, it will be Occidental. To an English person, it will seem like simplified English, as a skeptical Cambridge friend of mine told me what Occidental is. The European languages are members of the same family. Their separate existence is a myth. For science, music, sport, etc, Europe uses the same vocabulary. The languages only differ in their grammar, their pronunciation and their most common words.</p>
<h6 class="mb-3 fw-semibold text-uppercase">Sub-tasks</h6>
<ul class="ps-3 list-unstyled vstack gap-2">
<li>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="productTask">
<label class="form-check-label" for="productTask">
Product Design, Figma (Software), Prototype
</label>
</div>
</li>
<li>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="dashboardTask" checked>
<label class="form-check-label" for="dashboardTask">
Dashboards : Ecommerce, Analytics, Project,etc.
</label>
</div>
</li>
<li>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="calenderTask">
<label class="form-check-label" for="calenderTask">
Create calendar, chat and email app pages
</label>
</div>
</li>
<li>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="authenticationTask">
<label class="form-check-label" for="authenticationTask">
Add authentication pages
</label>
</div>
</li>
</ul>
<div class="pt-3 border-top border-top-dashed mt-4">
<h6 class="mb-3 fw-semibold text-uppercase">Tasks Tags</h6>
<div class="hstack flex-wrap gap-2 fs-15">
<div class="badge fw-medium bg-info-subtle text-info">UI/UX</div>
<div class="badge fw-medium bg-info-subtle text-info">Dashboard</div>
<div class="badge fw-medium bg-info-subtle text-info">Design</div>
</div>
</div>
</div>
</div>
</div>
<!--end card-->
</div>
<!--end col-->
</div>