Procházet zdrojové kódy

Simplify Frame.results

customisations
alemart před 11 měsíci
rodič
revize
5ffa5a075a
1 změnil soubory, kde provedl 1 přidání a 27 odebrání
  1. 1
    27
      src/core/frame.ts

+ 1
- 27
src/core/frame.ts Zobrazit soubor

22
 
22
 
23
 import { Session } from './session';
23
 import { Session } from './session';
24
 import { TrackerResult } from '../trackers/tracker';
24
 import { TrackerResult } from '../trackers/tracker';
25
-import { IllegalArgumentError } from '../utils/errors';
26
-
27
-/**
28
- * Iterable frame results (helper class)
29
- */
30
-class IterableTrackerResults implements IterableIterator<TrackerResult>
31
-{
32
-    private _index = 0;
33
-
34
-    constructor(private readonly _results: TrackerResult[])
35
-    {
36
-    }
37
-
38
-    next(): IteratorResult<TrackerResult>
39
-    {
40
-        const i = this._index++;
41
-        return i < this._results.length ?
42
-            { done: false, value: this._results[i] } :
43
-            { done: true,  value: undefined };
44
-    }
45
-
46
-    [Symbol.iterator](): IterableIterator<TrackerResult>
47
-    {
48
-        return this;
49
-    }
50
-}
51
 
25
 
52
 /**
26
 /**
53
  * A Frame holds information used to render a single animation frame of a Session
27
  * A Frame holds information used to render a single animation frame of a Session
87
     get results(): Iterable<TrackerResult>
61
     get results(): Iterable<TrackerResult>
88
     {
62
     {
89
         // we want to be able to iterate over the results of a frame multiple times
63
         // we want to be able to iterate over the results of a frame multiple times
90
-        return new IterableTrackerResults(this._results);
64
+        return this._results[Symbol.iterator]();
91
     }
65
     }
92
 }
66
 }

Načítá se…
Zrušit
Uložit