Pull requests are welcome. We do already have such a linker flag, called -s NO_EVAL=1, but Embind has not been compatible with it. If you'd like, feel free to work on expanding Embind to support such a -s NO_EVAL=1 build mode.
2017-08-14 21:39 GMT+03:00 Mitchell Foley <[email protected]>: > Currently, embind.js makes use of the function constructor here and here. 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. -- 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.
