v8

Can you call COM components from server side javascript?

蓝咒 提交于 2019-12-07 22:44:33
问题 Is it possible (using one of the server side implementations of javascript .. see http://www.nakedjavascript.com/getting-started-55) to instantiate a COM object and invoke methods on it? 回答1: There is node-win32ole ( npm install win32ole ). 回答2: That depends on which server-side implementation you’re using. When using ASP/JS (or any other framework using Microsoft’s Windows Scripting engine), that’s not a problem using the ActiveXObject constructor. When using JSDB, you can use the ActiveX

TypeError: 'ownKeys' on proxy: trap result did not include 'arguments'

冷暖自知 提交于 2019-12-07 14:49:57
问题 What do it wants from me? How to make it work? var proxy_handler = { ownKeys: function(target) { return Object.keys(target.data) }, } var proxxxy = function(initial_data) { var return_value = "Goodbye world" var target = function() { return return_value } if(typeof initial_data == "undefined") { target.data = {} } else { target.data = initial_data } return new Proxy(target, proxy_handler) } var p = proxxxy({q:"aaa",w:"bbb",f:"ccc"}) console.log(p()) console.log(Object.getOwnPropertyNames(p))

Why in this case native promises seems to be faster than callbacks in chrome?

送分小仙女□ 提交于 2019-12-07 14:47:44
问题 Here's the jsperf: http://jsperf.com/promise-vs-callback callback case (211 Ops/s): // async test var d = deferred; function getData(callback) { setTimeout(function() { callback('data') }, 0) } getData(function(data) { d.resolve() }) Promise case(614 ops/s): // async test var d = deferred; function getData() { return new Promise(function(resolve) { setTimeout(function() { resolve('data') }, 0); }) } getData().then(function(data) { d.resolve() }) As you see promise are way faster, but they

Google V8 Javascript Engine, Ubuntu and PHP - how to get it built and working?

烈酒焚心 提交于 2019-12-07 14:05:39
问题 some help would be much appreciated here. I am running Ubuntu 10.04, I want to use the V8 Javacript engine inside PHP. Has anyone managed to do this yet? So I installed libv8-2.0.3 , libv8-dbg , libv8-dev from the software centre. Then I tried: sudo pecl install v8js-0.1.2 . This failed due to (i think) this: /tmp/pear/temp/v8js/v8js.cc:220: error: no matching function for call to ‘v8::Array::Get(unsigned int&)’ and /tmp/pear/temp/v8js/v8js.cc:438: error: ‘ContextDisposedNotification’ is not

C++ - Qt + v8 under msvc2012

耗尽温柔 提交于 2019-12-07 12:45:10
问题 Recently, I've started a project under Qt5.1.0 . After some development, I choose to make a scripting system under Javascript with Google V8 . Under Windows 7 x64 , the only way to compile V8 is under msvc2012 , and I got 3 .lib files to use. In a single project using ONLY V8 , everything works well. But integrating V8 with an existent project using Qt5 it's a bit more complicated. Here is an example of a minimal code I'm using : (Of course, there is more file in this project...) #include

Converting Python objects to JavaScript for PyV8

不羁的心 提交于 2019-12-07 12:04:17
问题 I'm trying to pass Python data (lists, dicts, strings..., arbitrarily nested) to PyV8. class Global(object): def __init__(self, data): self.data = data ctx = PyV8.JSContext(Global([{'a':1}])) ctx.enter() res = ctx.eval('data.length') js_len = PyV8.convert(res) print js_len The code above prints None, presumably because the data object is not transformed to a JSArray and thus data.length evaluates to undefined . Is there a reliable way to do the necessary conversion in PyV8 other than using

Can Thread Local Storage be faked/hacked?

和自甴很熟 提交于 2019-12-07 07:51:21
问题 I find myself in a bit of a quandry. I have a large application which has Google's V8 javascript engine. Some calls are made to the V8 engine on the UI thread. To be nice to the user like everyone recommends, some long operations are run on a separate thread, without hanging the UI thread. However, these long running operations also make calls in to the V8 javascript engine. So multiple threads call in to V8. Thing is, V8 appears to use thread local storage. This seems to be making my

Embedding v8 with Visual C++ 2010

廉价感情. 提交于 2019-12-07 07:44:35
问题 I'm trying to embed the v8 engine to my C++ application. I use Visual C++ 2010. I've built it successfully using this command: scons env="INCLUDE:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files\Microsoft Visual Studio 10.0\VC\include,LIB:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Microsoft Visual Studio 9.0\VC\lib" And then, I: added the v8/include directory to Configuration Properties -> C/C++ -> General --> Additional Include Directories added

Nodejs profiling: parent in (sliced string)

和自甴很熟 提交于 2019-12-07 05:28:36
问题 I profiled my nodejs application and see some strange strings, it's marked as parent in (sliced string) . I using v8-profiler and node-inspector. Here is photo of profiler screen (sorry for photo, not screenshot, just my system really overloaded and don't have enough space to make screen): http://i.imgur.com/dkkPbGA.jpg So, my question, what is this parent in (sliced string) strings? UPD : After some review looks like i understand, when i made slice on string, it's stored parent string (is it

JavaScript - Object definition available before code execution on Safari

孤街浪徒 提交于 2019-12-07 04:55:26
Objects and functions which I require only to execute once on a page load are wrapped inside an undefined check for the object. On Chrome on Windows/Linux which I usually use, the code works perfectly i.e. code only executes once. But on Safari on both iPad and MacBook, the undefined check doesn't work i.e. as per the browser, the object/function is already declared without even the code execution reaching there! I've simplified my code to only include an if loop that checks if the nested function is already declared. Since it should not have been declared the first time, I've included