Skip to content

Commit

Permalink
Spec the drop() operator (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
domfarolino authored Feb 22, 2024
1 parent df44877 commit 5a5a427
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,35 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
<div algorithm>
The <dfn for=Observable method><code>drop(|amount|)</code></dfn> method steps are:

1. <span class=XXX>TODO: Spec this and use |amount|.</span>
1. Let |sourceObservable| be [=this=].

1. Let |observable| be a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
algorithm that takes a {{Subscriber}} |subscriber| and does the following:

1. Let |sourceObserver| be a new [=internal observer=], initialized as follows:

: [=internal observer/next steps=]
:: 1. If |amount| is &gt; 0, then decrement |amount| and abort these steps.

1. [=Assert=]: |amount| is 0.

1. Run |subscriber|'s {{Subscriber/next()}} method with the passed in <var
ignore>value</var>.

: [=internal observer/error steps=]
:: Run |subscriber|'s {{Subscriber/error()}} method, given the passed in <var
ignore>error</var>.

: [=internal observer/complete steps=]
:: Run |subscriber|'s {{Subscriber/complete()}} method.

1. Let |options| be a new {{SubscribeOptions}} whose {{SubscribeOptions/signal}} is
|subscriber|'s [=Subscriber/signal=].

1. <a for=Observable lt="subscribe to an Observable">Subscribe</a> to |sourceObservable|
given |sourceObserver| and |options|.

1. Return |observable|.
</div>

<div algorithm>
Expand Down

0 comments on commit 5a5a427

Please sign in to comment.