Currently, embind.js makes use of the function constructor here
<https://github.com/kripken/emscripten/blob/incoming/src/embind/embind.js#L183>
and here
<https://github.com/kripken/emscripten/blob/incoming/src/embind/embind.js#L933>.
It looks like this is used in order to dynamically create named functions.
However certain environments, such as chrome apps, do not allow the use of
the function constructor without additional permissions or overhead. I have
a two suggestions on how this could be improved.
A flag could be passed at compile time to generate these functions without
names. This would make debugging harder when the flag is on because there
wouldn't be named functions anymore, but if it means getting embind to work
in situations where it currently doesn't, this is an improvement.
If ES6 code is allowed in embind.js, functions can be dynamically named
using ES6 syntax. For example, the first use of new Function could be
replaced with this:
$createNamedFunction: function(name, body) {
name = makeLegalFunctionName(name);
return function() {
var obj = {
[name]: function() {
"use strict";
return body.apply(this, arguments);
}
};
return obj[name];
}();
},
If either of these sound reasonable, I'm happy to make these changes myself.
Thanks,
-Mitch
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.