Some checks failed
Main Confidence / confidence (push) Failing after 45s
## Summary - introduce surface-aware compressed governance outcomes and reuse the shared truth/explanation seams for operator-first summaries - apply the compressed outcome hierarchy across baseline, evidence, review, review-pack, canonical review/evidence, and artifact-oriented operation-run surfaces - expand spec 214 fixtures and Pest coverage, and fix tenant-panel route assertions by generating explicit tenant-panel URLs in the affected Filament tests ## Validation - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - focused governance compression suite from `specs/214-governance-outcome-compression/quickstart.md` passed (`68` tests, `445` assertions) - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryItemResourceTest.php tests/Feature/Filament/BackupSetUiEnforcementTest.php tests/Feature/Filament/RestoreRunUiEnforcementTest.php` passed (`18` tests, `81` assertions) Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #253
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
|
|
import { operate } from '../util/lift';
|
|
|
|
/**
|
|
* Asynchronously subscribes Observers to this Observable on the specified {@link SchedulerLike}.
|
|
*
|
|
* With `subscribeOn` you can decide what type of scheduler a specific Observable will be using when it is subscribed to.
|
|
*
|
|
* Schedulers control the speed and order of emissions to observers from an Observable stream.
|
|
*
|
|
* 
|
|
*
|
|
* ## Example
|
|
*
|
|
* Given the following code:
|
|
*
|
|
* ```ts
|
|
* import { of, merge } from 'rxjs';
|
|
*
|
|
* const a = of(1, 2, 3);
|
|
* const b = of(4, 5, 6);
|
|
*
|
|
* merge(a, b).subscribe(console.log);
|
|
*
|
|
* // Outputs
|
|
* // 1
|
|
* // 2
|
|
* // 3
|
|
* // 4
|
|
* // 5
|
|
* // 6
|
|
* ```
|
|
*
|
|
* Both Observable `a` and `b` will emit their values directly and synchronously once they are subscribed to.
|
|
*
|
|
* If we instead use the `subscribeOn` operator declaring that we want to use the {@link asyncScheduler} for values emitted by Observable `a`:
|
|
*
|
|
* ```ts
|
|
* import { of, subscribeOn, asyncScheduler, merge } from 'rxjs';
|
|
*
|
|
* const a = of(1, 2, 3).pipe(subscribeOn(asyncScheduler));
|
|
* const b = of(4, 5, 6);
|
|
*
|
|
* merge(a, b).subscribe(console.log);
|
|
*
|
|
* // Outputs
|
|
* // 4
|
|
* // 5
|
|
* // 6
|
|
* // 1
|
|
* // 2
|
|
* // 3
|
|
* ```
|
|
*
|
|
* The reason for this is that Observable `b` emits its values directly and synchronously like before
|
|
* but the emissions from `a` are scheduled on the event loop because we are now using the {@link asyncScheduler} for that specific Observable.
|
|
*
|
|
* @param scheduler The {@link SchedulerLike} to perform subscription actions on.
|
|
* @param delay A delay to pass to the scheduler to delay subscriptions
|
|
* @return A function that returns an Observable modified so that its
|
|
* subscriptions happen on the specified {@link SchedulerLike}.
|
|
*/
|
|
export function subscribeOn<T>(scheduler: SchedulerLike, delay: number = 0): MonoTypeOperatorFunction<T> {
|
|
return operate((source, subscriber) => {
|
|
subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));
|
|
});
|
|
}
|