Pārlūkot izejas kodu

Remove Source._type

customisations
alemart 2 mēnešus atpakaļ
vecāks
revīzija
49ac88b924

+ 2
- 11
src/sources/canvas-source.ts Parādīt failu

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
      * Check if this source is of a certain type
63
      * Check if this source is of a certain type
73
      * @internal
64
      * @internal
74
      */
65
      */
75
     _is<T extends keyof SourceType>(type: T): this is SourceType[T]
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
     _init(): SpeedyPromise<void>
102
     _init(): SpeedyPromise<void>
112
     {
103
     {
113
         return Speedy.load(this._canvas).then(media => {
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
             this._media = media;
106
             this._media = media;
116
         });
107
         });
117
     }
108
     }

+ 1
- 10
src/sources/pointer-source.ts Parādīt failu

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
      * Check if this source is of a certain type
55
      * Check if this source is of a certain type
65
      * @internal
56
      * @internal
66
      */
57
      */
67
     _is<T extends keyof SourceType>(type: T): this is SourceType[T]
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 Parādīt failu

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

+ 3
- 12
src/sources/video-source.ts Parādīt failu

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
      * Check if this source is of a certain type
70
      * Check if this source is of a certain type
80
      * @internal
71
      * @internal
81
      */
72
      */
82
     _is<T extends keyof SourceType>(type: T): this is SourceType[T]
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
      */
108
      */
118
     _init(): SpeedyPromise<void>
109
     _init(): SpeedyPromise<void>
119
     {
110
     {
120
-        Utils.log(`Initializing ${this._type} source...`);
111
+        Utils.log(`Initializing video source...`);
121
 
112
 
122
         // prepare the video before loading the SpeedyMedia!
113
         // prepare the video before loading the SpeedyMedia!
123
         return this._prepareVideo(this._video).then(video => {
114
         return this._prepareVideo(this._video).then(video => {
124
             Utils.log('The video is prepared');
115
             Utils.log('The video is prepared');
125
 
116
 
126
             return Speedy.load(video).then(media => {
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
                 this._media = media;
119
                 this._media = media;
129
             });
120
             });
130
         });
121
         });

Notiek ielāde…
Atcelt
Saglabāt