-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context has no Isolate available anymore #269
Comments
Hey @mathieujobin. Could you provide a bit more context? Ideally something that is reproducible. With just this three lines of code you provided, it's difficult to help. |
Right, thank you for getting back to me... I don't master the code base yet. We are creating the context in such a way, ... v8_context ||= MiniRacer::Context.new.tap do |context|
context.load(LibDSL.root.join("vendor/underscore.js"))
end it used to be V8::Context from TheRubyRacer. This is kept in a class instance var, which we I found out I can skip that error by creating a fresh object for each instance. It's unclear why it makes a difference, This moves me to the next problem I have, migrating to mini_racer. Which isn't exactly related to the previous error. But I'll continue here instead of creating a separate issue for now. It appears TheRubyRacer's V8::Context had the ability to store attributes via a I could do
MiniRacer does not appear to have it, don't think its a big deal, I can store it elsewhere. but if that rings a bell. Feel free to comment. Next, I do js_function_ref = V8::Context.new.eval("(function(a,b,c) { return a + '-' + b + '-' + c; })") which appears to work fine, it returns me a
now I get
any idea what can I do about this one ? Thanks |
Looks like I found the solution to my last problem... reading #224 I realize I now need to make the call to the context, but my functions don't have names as shown... so I am creating anonymous names... such like this. set_callback :initialize, :after do
@fn_name = "custom_#{SecureRandom.hex(5)}"
@function_ref = js_context.eval("#{@fn_name} = (#{body})")
end then I am able to make calls like this def call(environment, args)
initialize_js_context(environment)
js_context.call(@fn_name, *args)
end very happy ! Thank you |
I am upgrading a project that was using V8::Context#load directly with therubyracer.
I am trying to replace it with MiniRacer::Context
getting this error
with this code
I'm not too sure what it means?
it crashes here
mini_racer/lib/mini_racer.rb
Line 225 in 719abdb
The text was updated successfully, but these errors were encountered: