|
@@ -14,4 +14,38 @@ A reference to the [tracker](tracker.md) that generated this result.
|
14
|
14
|
|
15
|
15
|
`result.trackables: Trackable[], read-only`
|
16
|
16
|
|
17
|
|
-An array of zero or more [trackables](trackable.md).
|
|
17
|
+An array of zero or more [trackables](trackable.md).
|
|
18
|
+
|
|
19
|
+## Methods
|
|
20
|
+
|
|
21
|
+### of
|
|
22
|
+
|
|
23
|
+`result.of(trackerType: string): boolean`
|
|
24
|
+
|
|
25
|
+Checks if `this` result was generated by tracker of a certain `trackerType`. This is a convenient type guard for TypeScript users. See also: [Tracker.is](./tracker.md#is).
|
|
26
|
+
|
|
27
|
+*Since:* 0.4.4
|
|
28
|
+
|
|
29
|
+**Returns**
|
|
30
|
+
|
|
31
|
+The same as `tracker.is(trackerType)`.
|
|
32
|
+
|
|
33
|
+**Example**
|
|
34
|
+
|
|
35
|
+```ts
|
|
36
|
+let result: TrackerResult;
|
|
37
|
+
|
|
38
|
+// ...
|
|
39
|
+
|
|
40
|
+if(result.of('image-tracker')) {
|
|
41
|
+ // result is inferred to be an ImageTrackerResult
|
|
42
|
+ // ...
|
|
43
|
+}
|
|
44
|
+else if(result.of('pointer-tracker')) {
|
|
45
|
+ // result is inferred to be a PointerTrackerResult
|
|
46
|
+ // ...
|
|
47
|
+}
|
|
48
|
+else {
|
|
49
|
+ // ...
|
|
50
|
+}
|
|
51
|
+```
|