HTML pass constant or function to JavaScript
<p>I'm currently writing a JavaScript library to plot functions in the browser. The user includes the library and adds a <code>div</code> of specific class to the page. He is able to tell the library what to plot via <code>data-*</code> attributes of the <code>div</code>.</p>

<p>Now I do want that the user is able to pass constant values or javascript-functions as arguments and my library reads the constant or evaluates the function. How would I do this?</p>

<p><strong>Example:</strong></p>

<pre><code>&lt;script&gt;
function range-value() {
  var range = document.getElementById("random-range");
  return range.value;
}
&lt;/script&gt;

&lt;div class="plot-example" data-plot-xMin="-1"&gt;&lt;/div&gt;
&lt;div class="plot-example" data-plot-xMin="range-value"&gt;&lt;/div&gt;
</code></pre>

<p>This would make the lib way more flexible, but how would I handle the incoming data intern?</p>