mofron-comp-text
Advanced tools
Comparing version 0.3.11 to 0.3.12
40
index.js
@@ -15,8 +15,8 @@ /** | ||
* | ||
* @param prm : (string) text contents | ||
* @param opt : (object) component option | ||
* @param prm_opt : (string) text contents | ||
* @param prm_opt : (object) component option | ||
*/ | ||
constructor (prm, opt) { | ||
constructor (prm_opt) { | ||
try { | ||
super(prm); | ||
super(); | ||
this.name('Text'); | ||
@@ -28,6 +28,4 @@ | ||
/* set option */ | ||
if (null !== opt) { | ||
this.option(opt); | ||
} | ||
/* set prameter / option */ | ||
this.prmOpt(prm_opt); | ||
} catch (e) { | ||
@@ -46,6 +44,2 @@ console.error(e.stack); | ||
try { | ||
if ('string' != (typeof prm)) { | ||
throw new Error('invalid parameter'); | ||
} | ||
/* init vdom contents */ | ||
@@ -56,7 +50,8 @@ var text = new mofron.util.Dom('div', this); | ||
var txt_conts = this.text(); | ||
if (null === txt_conts) { | ||
txt_conts = prm; | ||
/* set text contents */ | ||
if (null === this.text()) { | ||
this.text(prm); | ||
} else { | ||
this.text(this.text()); | ||
} | ||
text.text(txt_conts); | ||
@@ -82,14 +77,15 @@ /* set font theme */ | ||
try { | ||
var _val = (val === undefined) ? null : val; | ||
if (null === _val) { | ||
if (undefined === val) { | ||
/* getter */ | ||
return this.m_text; | ||
} | ||
if ('string' !== (typeof _val)) { | ||
/* setter */ | ||
if ('string' !== (typeof val)) { | ||
throw new Error('invalid parameter'); | ||
} | ||
if (false === this.isRendered()) { | ||
if (null === this.vdom()) { | ||
this.m_text = val; | ||
return; | ||
} else { | ||
this.target().text(val); | ||
} | ||
this.target().text(_val); | ||
} catch (e) { | ||
@@ -96,0 +92,0 @@ console.error(e.stack); |
{ | ||
"name": "mofron-comp-text", | ||
"version": "0.3.11", | ||
"version": "0.3.12", | ||
"description": "text component for mofron", | ||
@@ -24,5 +24,3 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://github.com/simpart/mofron-comp-text#readme", | ||
"devDependencies": { | ||
} | ||
"homepage": "https://github.com/simpart/mofron-comp-text#readme" | ||
} |
8564
199