add $this feature description

This commit is contained in:
arcan1s
2015-09-03 00:31:29 +03:00
parent a1126c14b8
commit c48f40d50c
2 changed files with 34 additions and 2 deletions

View File

@ -563,7 +563,23 @@ $down - $up
{% raw %}}}{% endraw %}
{% endhighlight %}
<p>will show difference between download and upload speed. Thus this feature may be used for example to show any custom values which will be calculated in runtime and to show different information depending on some conditions. But please keep in mind that such runtime calculation may increase CPU load.</p>
<p>will show difference between download and upload speed. Another feature provided by lambda functions is <code>$this</code> value which returns the last value of the lambda function. Here is a little more complicated example which will show running line "Artist - Title" with length less or equal than 20 symbols:</p>
{% highlight javascript %}
{% raw %}${{{% endraw %}
function runningLine() {
var current = "$artist - $title";
var index = current.indexOf("$this");
if (("$this" == "") || ((index + 20 + 1) > current.length))
return current.substring(0, 20);
else
return current.substring(index + 1, index + 20 + 1);
}
runningLine()
{% raw %}}}{% endraw %}
{% endhighlight %}
<p>Thus this feature may be used for example to show any custom values which will be calculated in runtime and to show different information depending on some conditions. But please keep in mind that such runtime calculation may increase CPU load.</p>
<h4><a href="#advanced" class="anchor" id="advanced"><span class="octicon octicon-link"></span></a>Advanced settings</h4>
<p><b>Widget height:</b> Disable automatic widget height definition and set it to this value. Default is <code>0</code> (auto).</p>