As long as console.log or setInterval is not called when you create the snapshot, it's fine. The variable resolution for global variables happens at runtime, after the snapshot has been deserialized. I'd suggest simply putting everything you need into one .js file to create the snapshot from.
On Thursday, January 7, 2016 at 4:47:52 PM UTC+1, Hugh Fitzpatrick wrote: > > Ben, > > Thanks for the reply. > > I got *console.log(..) *to work.... but I guess more complex stuff like > *setInterval(..)* is dependent on Node. > > I'm trying to use snapshots with an embedded Node/V8 application - they > may help with startup times. > > I'll let you know how I get on. > > - Hugh > > On Thursday, 7 January 2016 10:11:30 UTC-5, Ben Noordhuis wrote: >> >> On Thu, Jan 7, 2016 at 3:49 PM, Hugh Fitzpatrick >> <[email protected]> wrote: >> > For instance - I cannot access console.log(..) or use require. >> > >> > ... Any thoughts on getting these to work ? Can I combine *many* JS >> files >> > in a snapshot ? >> >> You can't use node.js specific code in snapshot creation. >> >> I'm not sure about deserialization; certainly not at deserialization >> time itself because any node.js specific logic won't have been >> installed yet. >> >> Functions exported by the snapshot in theory should be able to call >> `console.log` (`console` is a global object that can be lazily >> resolved) but IIRC, there are some restrictions on scope lookup in >> serialized code that may prohibit that. >> >> require() won't work, it's not a global and snapshot code doesn't run >> in module context. >> > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" 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.
