File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 1
1
class Ctx {
2
- constructor ( template ) {
3
- this . _temp = "" ;
4
- this . _parentTemp = `return @temp;` ;
2
+ constructor ( ) {
3
+ this . _temp = '' ;
4
+ this . _parentTemp = `"use strict"; return @temp;` ;
5
5
this . _defaultCom = null ;
6
6
this . _com = null ;
7
7
this . _b = window . Babel ;
8
- this . _babelpresets = [ "react" ] ;
9
- this . updateTemplate ( template ) ;
8
+ this . _babelpresets = [ 'react' ] ;
10
9
}
11
10
_transpile ( ) {
12
11
return this . _b . transform ( this . _temp , {
13
12
presets : this . _babelpresets ,
14
13
} ) . code ;
15
14
}
16
15
_generateCom ( ) {
17
- this . _com = this . _temp
18
- ? Function ( this . _parentTemp . replace ( "@temp" , this . _transpile ( ) ) ) ( )
19
- : this . _defaultCom ;
16
+ this . _com = this . _temp ? Function ( this . _parentTemp . replace ( '@temp' , this . _transpile ( ) ) ) ( ) : this . _defaultCom ;
20
17
}
21
18
updateTemplate ( template ) {
22
- template = template || "" ;
19
+ template = template || '' ;
23
20
if ( template !== this . _temp ) {
24
21
this . _temp = template ;
25
22
this . _generateCom ( ) ;
You can’t perform that action at this time.
0 commit comments