You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't strictly rusty_v8, but it's been hard to find any resources on this, so I thought I'd start here since you folks might be able to help.
Is there any way I can override the Math.random function with a global object template? By this I mean I want to provide an object_template in the ContextOptions when creating a context that defines a Math.random. I've already figured out that that I can (and how to) override Math.randomafter the context is created, but ideally I'd be able to bundle this work in the same global template, since I'm already using it for other things (side question: does it matter performance-wise to provide a global object template when creating the context, or modifying the global object after creating the context?).
Here's some code that I tried, but the result shows that Math.random wasn't overridden:
This isn't strictly rusty_v8, but it's been hard to find any resources on this, so I thought I'd start here since you folks might be able to help.
Is there any way I can override the
Math.random
function with a global object template? By this I mean I want to provide anobject_template
in theContextOptions
when creating a context that defines aMath.random
. I've already figured out that that I can (and how to) overrideMath.random
after the context is created, but ideally I'd be able to bundle this work in the same global template, since I'm already using it for other things (side question: does it matter performance-wise to provide a global object template when creating the context, or modifying the global object after creating the context?).Here's some code that I tried, but the result shows that
Math.random
wasn't overridden:The text was updated successfully, but these errors were encountered: