Results 172 comments of D. Bohdan

You can also allow JavaScript to evaluate Tcl code directly. ```tcl set duk [::duktape::init] ::duktape::make-unsafe $duk ::duktape::eval $duk { Duktape.tcl.eval("puts", "hi") } ```

> Could that approach be used to create a JS object literal, and then set back to `safe` mode? If you call `make-safe` after `make-unsafe`, closures over `Duktape.tcl.eval` will stop...

Not directly. You can do something like this: ```tcl package require duktape set duk [::duktape::init] ::duktape::tcl-function $duk foo {} { lindex hi } ::duktape::eval $duk { obj = {}; obj.foo...

Not directly, since Tcl doesn't have closures. You can see the ["Closures"](https://wiki.tcl-lang.org/page/Closures) page in the Tcler's Wiki for tricks people use to simulate closures.

You could implement properties in a generic way with a Tcl dict or namespace. Here is a namespace implementation based on your example: ```tcl package require duktape::oo set interp [::duktape::oo::Duktape...

> If `obj` is the global object this happens: [...] I don't have enough context. Please give me a complete code snippet if you want me to comment on this....

Try this: ```tcl package require duktape::oo set interp [::duktape::oo::Duktape new] $interp tcl-function doSomething arg {return "window did: $arg"} namespace eval ::Window { variable prop 5 ;# Set initial property value...

Okay, I have looked around in your codebase. My recommendation to you is that if you are going to use tcl-duktape, you should fork it and modify the fork as...

It's simpler to use existing bindings to get started, but as I said, I think tcl-duktape is not going to satisfy the needs of your project.

This sounds like a huge task. Duktape itself doesn't implement a DOM (see https://github.com/svaarala/duktape/issues/2119). You'd be better off making [jsdom](https://github.com/jsdom/jsdom) or a similar library run in tcl-duktape than trying to...