v8

Is node.js a viable alternative to traditional scripting languages like Perl and Python? [closed]

半世苍凉 提交于 2019-12-03 14:38:05
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Recently I've fallen out of love with Perl as a cross-platform general purpose scripting language, and niether Python nor Ruby ever

Node.JS vm.runInNewContext() vs require() and eval()

耗尽温柔 提交于 2019-12-03 13:42:28
Is vm.runInNewContext considered black magic like eval ? Is there a significant performance difference between require and reading a file and using vm to run it or is the the same under the hood (if you implemented caching etc and just wanted to add some variables to the context) Jan Jongboom runInNewContext is not meant to be used as a replacement of require or eval , but instead as a way to create a sandbox environment where you can safely run other scripts. Disadvantages are that it's slow (creation takes ~10 ms.) and takes up a couple megabytes. So no, don't use it as a require replacement

Does the .pipe() perform a memcpy in node.js?

笑着哭i 提交于 2019-12-03 12:52:08
This is a conceptual query regarding system level optimisation. My understanding by reading the NodeJS Documentation is that pipes are handy to perform flow control on streams. Background: I have microphone stream coming in and I wanted to avoid an extra copy operation to conserve overall system MIPS. I understand that for audio streams this is not a great deal of MIPS being spent even if there was a memcopy under the hood, but I also have an extension planned to stream in camera frames at 30fps and UHD resolution. Making multiple copies of UHD resolution pixel data at 30fps is super

Perl: Javascript::V8 templates - from the perl

喜你入骨 提交于 2019-12-03 12:49:41
问题 Looking for template engine like HTML::Mason (or Mason), so what "compiles" source components into perl code, but instead of perl-code will "compile" components into JavaScript code and after run/execute them with Javascript::V8 perl module. Motivation: Looking for solution for safe template language, what can edit users without compromising the server security . JavaScript is full featured language so using it is probably better/faster than some "mini languages" like TT or similar. The best

Build googles v8 as shared library on windows?

一个人想着一个人 提交于 2019-12-03 12:45:53
Is it possible to build googles v8 as a shared library with gyp on windows (msvc 2012)? Everything I tried doesn't work. What I've tried: python build\gyp_v8 -Dcomponent=shared_library python build\gyp_v8 library=shared The second one gives an error that "library" is unknown. The first one does not have any effect. This works in a project I'm using: python build\gyp_v8 -Dtarget_arch=ia32 -Dcomponent=shared_library msbuild /p:Configuration=Release /p:Platform=Win32 tools\gyp\v8.sln 来源: https://stackoverflow.com/questions/14916272/build-googles-v8-as-shared-library-on-windows

How to convert v8 Value to Array

混江龙づ霸主 提交于 2019-12-03 11:33:56
问题 I'm writing a c++ extension to v8, and want to pass an Array object into it. I see the incoming argument can be tested by IsArray(), but there isn't a ToArray(). How do you get access to its Length, and request elements by numeric index? Handle<Value> MyExtension(const Arguments& args) { Handle<Value> v = args[0]; if(v->IsArray()) { // convert to array, find its length, and access its members by index... ? } ... } Must be missing something obvious here. Object can return all its properties,

Is it possible to make Node.js use Rhino as the Javascript engine?

允我心安 提交于 2019-12-03 11:25:53
I use Node.js for several jobs on my web apps and so far everthing's ok. But the Node.js uses Google's V8 as the default Javascript engine (JSE) and V8 runs exlusively on the x86 and ARM Instruction Set Architectures (ISA). Now I have a PPC processor Mac computer on which I want to run the Node.js . To do that, I'm adviced to use the Rhino + OpenJDK Shark Virtual Machine + Low Level Virtual Machine ( LLVM ) as the JIT compiler. Currently, that looks like the most applicable way of running Node.js on the PPC ISA. Or, is there a better way to do it? Could you tell beforehand if it would be

Pop up blocker API- how to check if user has it enabled

浪尽此生 提交于 2019-12-03 10:58:15
问题 I need to know when the user clicks on the button that triggers window.open if there is stable API/way to know beforehand if the user actively has a pop-up blocker? In some cases the user doesn't know/pay attention that they have pop-up blocker (that block the new window). I would like to inform them by some dialog/or something to authorize a new window by clicking on allow. 回答1: Window.open(...) returns a handle to the new window if it exists. If it doesn't have a handle to the new window,

Trace the execution of ALL Javascript in a web app

♀尐吖头ヾ 提交于 2019-12-03 10:56:11
Here is the situation: A complex web app is not working, and it is possible to produce undesired behavior consistently. The cause of the problem is not known. Proposal: Trace the execution paths of all javascript code. Essentially, produce two monstrous logs which can then be fed into a diff algorithm to determine where the behavior related to the bug begins to diverge (as the cause is not apparent from application behavior, and both comprehending and obtaining a copy of the actual JS code being run is difficult, due to the many pages that must be switched to and copied out from the web

How do I pump window messages in a nodejs addon?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 09:40:54
问题 In a Windows nodejs addon, I've created a window for the purpose of receiving messages. Handle<Value> MakeMessageWindow(const Arguments &args) { // exposed to JS ... CreateWindow(L"ClassName", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); ... } I have a wndproc function. Local<Function> wndProc; LRESULT APIENTRY WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // pack up the arguments into Local<Value> argv wndProc->Call(Context::GetCurrent()->Global(), 3, argv); } Now I need to