浏览代码

Simplify Frame.results

customisations
alemart 11 个月前
父节点
当前提交
5ffa5a075a
共有 1 个文件被更改,包括 1 次插入27 次删除
  1. 1
    27
      src/core/frame.ts

+ 1
- 27
src/core/frame.ts 查看文件

@@ -22,32 +22,6 @@
22 22
 
23 23
 import { Session } from './session';
24 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 27
  * A Frame holds information used to render a single animation frame of a Session
@@ -87,6 +61,6 @@ export class Frame
87 61
     get results(): Iterable<TrackerResult>
88 62
     {
89 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
 }

正在加载...
取消
保存