Sfoglia il codice sorgente

Remove Source._type

customisations
alemart 2 mesi fa
parent
commit
49ac88b924

+ 2
- 11
src/sources/canvas-source.ts Vedi File

@@ -60,21 +60,12 @@ export class CanvasSource implements Source
60 60
     }
61 61
 
62 62
     /**
63
-     * A type-identifier of the source of data
64
-     * @internal
65
-     */
66
-    get _type(): keyof SourceType
67
-    {
68
-        return 'canvas';
69
-    }
70
-
71
-    /**
72 63
      * Check if this source is of a certain type
73 64
      * @internal
74 65
      */
75 66
     _is<T extends keyof SourceType>(type: T): this is SourceType[T]
76 67
     {
77
-        return type === this._type;
68
+        return type === 'canvas';
78 69
     }
79 70
 
80 71
     /**
@@ -111,7 +102,7 @@ export class CanvasSource implements Source
111 102
     _init(): SpeedyPromise<void>
112 103
     {
113 104
         return Speedy.load(this._canvas).then(media => {
114
-            Utils.log(`Source of data is a ${media.width}x${media.height} ${this._type}`);
105
+            Utils.log(`Source of data is a ${media.width}x${media.height} canvas`);
115 106
             this._media = media;
116 107
         });
117 108
     }

+ 1
- 10
src/sources/pointer-source.ts Vedi File

@@ -52,21 +52,12 @@ export class PointerSource implements Source
52 52
     }
53 53
 
54 54
     /**
55
-     * A type-identifier of the source of data
56
-     * @internal
57
-     */
58
-    get _type(): keyof SourceType
59
-    {
60
-        return 'pointer-source';
61
-    }
62
-
63
-    /**
64 55
      * Check if this source is of a certain type
65 56
      * @internal
66 57
      */
67 58
     _is<T extends keyof SourceType>(type: T): this is SourceType[T]
68 59
     {
69
-        return type === this._type;
60
+        return type === 'pointer-source';
70 61
     }
71 62
 
72 63
     /**

+ 0
- 3
src/sources/source.ts Vedi File

@@ -30,9 +30,6 @@ import { VideoSource } from './video-source';
30 30
  */
31 31
 export interface Source
32 32
 {
33
-    /** @internal type-identifier of the source of data */
34
-    readonly _type: keyof SourceType;
35
-
36 33
     /** @internal check if this source is of a certain type */
37 34
     _is<T extends keyof SourceType>(type: T): this is SourceType[T];
38 35
 

+ 3
- 12
src/sources/video-source.ts Vedi File

@@ -67,21 +67,12 @@ export class VideoSource implements Source
67 67
     }
68 68
 
69 69
     /**
70
-     * A type-identifier of the source of data
71
-     * @internal
72
-     */
73
-    get _type(): keyof SourceType
74
-    {
75
-        return 'video';
76
-    }
77
-
78
-    /**
79 70
      * Check if this source is of a certain type
80 71
      * @internal
81 72
      */
82 73
     _is<T extends keyof SourceType>(type: T): this is SourceType[T]
83 74
     {
84
-        return type === this._type;
75
+        return type === 'video';
85 76
     }
86 77
 
87 78
     /**
@@ -117,14 +108,14 @@ export class VideoSource implements Source
117 108
      */
118 109
     _init(): SpeedyPromise<void>
119 110
     {
120
-        Utils.log(`Initializing ${this._type} source...`);
111
+        Utils.log(`Initializing video source...`);
121 112
 
122 113
         // prepare the video before loading the SpeedyMedia!
123 114
         return this._prepareVideo(this._video).then(video => {
124 115
             Utils.log('The video is prepared');
125 116
 
126 117
             return Speedy.load(video).then(media => {
127
-                Utils.log(`Source of data is a ${media.width}x${media.height} ${this._type}`);
118
+                Utils.log(`Source of data is a ${media.width}x${media.height} video`);
128 119
                 this._media = media;
129 120
             });
130 121
         });

Loading…
Annulla
Salva