addJSFunction function
Adds a JavaScript function into DOM.
name
Name of the function.
parameters
Parameters names of the function.
body
Content of the function.
Implementation
Future<bool> addJSFunction(String name, List<String> parameters, String body) {
if (name.isEmpty) throw ArgumentError('Empty name');
var args = parameters.join(' , ');
var code = '$name = function( $args ) {\n$body\n}';
return addJavaScriptCode(code);
}