SpiderMonkey Standalone Commandline & Stdio

Jul 23, 2005

1) Running a standalone script with SpiderMonkey on Linux
js -f scriptfile.js scriptarg

How can I get the value of scriptarg from within the JavaScript
scriptfile?


2) Running a standalone script with SpiderMonkey on Linux

How can I do formated printing to stdout?

(I see that /js/src/perfect.js uses print() is there an equivalent for
printing formated reals?)


3) Running a standalone script with SpiderMonkey on Linux

How can I read from stdin?

View 3 Replies


ADVERTISEMENT

JavaScript - SpiderMonkey And QNX 4

Jul 23, 2005

Does anyone know of a port of the SpiderMonkey JavaScript engine to QNX 4?

View 1 Replies View Related

Spidermonkey Embedding: How Can I Set Class Properties?

Jul 23, 2005

I am embedding Spidermonkey in a C app. and I'm having trouble setting
class (not instance) property values. For example, I am setting up
the class as follows:

static JSBool constructor(JSContext *cx, JSObject *obj, uintN argc, jsval
*argv, jsval *rval)
{
printf("constructor argc = %d
", argc);
*rval = OBJECT_TO_JSVAL(obj);
return JS_TRUE;
}

main()
{
....
static JSClass my_class = {
"MyClass", JSCLASS_HAS_PRIVATE,
JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS _PropertyStub,
JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_ FinalizeStub
};
static JSPropertySpec class_props[] = {
{"Prop1", 0, JSPROP_ENUMERATE},
{0}
};
JSObject *proto;

proto = JS_InitClass(cx, JS_GetGlobalObject(cx), 0, &my_class,
constructor, 1, NULL, NULL, class_props, NULL);

The above code correctly (verified through a JavaScript program). creates a new class with the Prop1 class property.

The following code correctly adds an _instance_ property:

jsval val = INT_TO_JSVAL(42);
JS_SetProperty(cx, proto, "MyProp2", &val);

After three days I still can't figure out how to set the value of the class
property, or, for that matter, create a new class property with a particular value. I am looking to do something like this:

jsval val = INT_TO_JSVAL(88);
JS_SetProperty(cx, ???, "Prop1", &val);

View 3 Replies View Related

Capture Window In *standalone* Javascript

May 12, 2007

I want to make a capture window in
*standalone* (in a *.js file) javascript, much in the same way as the
VBscript inputbox() function. I can make it inside a *.html file with
the prompt() function.

Or, is there a way to make a window and then work with this window?

View 3 Replies View Related

JQuery :: $(document).ready In A Standalone SVG Don't Work

Oct 16, 2011

I've got some difficulties with my standalone SVG.here is my code:

<svg onload="init(evt)" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<script type="text/javascript" xlink:href="jquery.js"></script>
<script type="text/javascript" xlink:href="jquery.svg.js"></script>

[Code].....

When I load the SVG, I've got the "ping" but not the "pong"?!

I'm using jquery 1.6.2 with jquery SVG plugin 1.4.4

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved