mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 13:01:22 +00:00
Merge pull request #1492 from RReverser/function-new-with-args
Add bindings for `new Function(args, body)`
This commit is contained in:
@ -987,6 +987,17 @@ extern "C" {
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub type Function;
|
||||
|
||||
/// The `Function` constructor creates a new `Function` object. Calling the
|
||||
/// constructor directly can create functions dynamically, but suffers from
|
||||
/// security and similar (but far less significant) performance issues
|
||||
/// similar to `eval`. However, unlike `eval`, the `Function` constructor
|
||||
/// allows executing code in the global scope, prompting better programming
|
||||
/// habits and allowing for more efficient code minification.
|
||||
///
|
||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new_with_args(args: &str, body: &str) -> Function;
|
||||
|
||||
/// The `Function` constructor creates a new `Function` object. Calling the
|
||||
/// constructor directly can create functions dynamically, but suffers from
|
||||
/// security and similar (but far less significant) performance issues
|
||||
|
Reference in New Issue
Block a user