ker/mod/tfw.view.icon.js
function onContentChanged( contentStringOrObject ) {
    try {
        const
            isString = typeof contentStringOrObject === 'string',
            content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;

        this._content = createSvgFromDefinition.call( this, content );
        if ( !this._content ) return;
        $.clear( this, this._content.svgRootGroup );

        // Update pens' colors.
        for ( const penIndex of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) {
            updatePen.call( this, penIndex, this[ `pen${penIndex}` ] );
        }

        this.$.style.display = "";
    } catch ( ex ) {
        this.$.style.display = "none";
        if ( this.content !== '' ) this.content = '';
    }
}
function onContentChanged( contentStringOrObject ) {
    try {
        const
            isString = typeof contentStringOrObject === 'string',
            content = isString ? Icons.iconsBook[ contentStringOrObject ] : contentStringOrObject;

        this._content = createSvgFromDefinition.call( this, content );
        if ( !this._content ) return;
        $.clear( this, this._content.svgRootGroup );

        // Update pens' colors.
        for ( const penIndex of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) {
            updatePen.call( this, penIndex, this[ `pen${penIndex}` ] );
        }

        this.$.style.display = "";
    } catch ( ex ) {
        this.$.style.display = "none";
        if ( this.content !== '' ) this.content = '';
    }
}
function onContentChanged ( contentStringOrObject ) { try { const isString = typeof contentStringOrObject === 'string' , content = isString ? Icons . iconsBook [ contentStringOrObject ] : contentStringOrObject ; this . _content = createSvgFromDefinition . call ( this , content ) ; if ( ! this . _content ) return ; $ . clear ( this , this . _content . svgRootGroup ) ; // Update pens' colors. for ( const penIndex of [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) { updatePen . call ( this , penIndex , this [ ` ${ penIndex } ` ] ) ; } this . $ . style . display = "" ; } catch ( ex ) { this . $ . style . display = "none" ; if ( this . content !== '' ) this . content = '' ; } }
Create SVG icon from `content`

@this ViewXJS
@param   {object|string} contentStringOrObject - Can be an icon name or a SVG description.
@returns {undefined}
Create SVG icon from content