File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { component , ViewModel , HTMLMorph } from 'lively.morphic' ;
2
2
import { pt } from 'lively.graphics/geometry-2d.js' ;
3
+ import { fun } from 'lively.lang' ;
3
4
4
5
class YouTubeEmbedViewModel extends ViewModel {
5
6
static get properties ( ) {
@@ -10,8 +11,12 @@ class YouTubeEmbedViewModel extends ViewModel {
10
11
}
11
12
12
13
async viewDidLoad ( ) {
13
- // Browsers do not like us importing this in more than once place...
14
- window . liteYouTubeEmbed ? null : ( window . liteYouTubeEmbed = await System . import ( 'lite-youtube-embed' ) ) ;
14
+ // Browsers do not like us importing this in more than once...
15
+ if ( ! window . liteYouTubeEmbed ) {
16
+ await fun . guardNamed ( 'import-lite-youtube-embed' , async ( ) => {
17
+ window . liteYoutubeEmbed = await System . import ( 'lite-youtube-embed' ) ;
18
+ } ) ( ) ;
19
+ }
15
20
this . view . html = `<lite-youtube videoid="${ this . videoID } " width="100%" height="100%" style="max-width: ${ this . maxWidth } ;"></lite-youtube>` ;
16
21
}
17
22
}
You can’t perform that action at this time.
0 commit comments