Skip to content

Conversation

@SpencerPark
Copy link
Contributor

Another small PR but small PR's get merged quicker :)

This one prints all arguments passed to console.log and also makes __unicode__ work as expected in py3. repr still used __repr__ but str uses __str__ (or __unicode__ on py2) so when printing objects we get the expected result (strings without quotes).

Also now supports calling console.log with no arguments to print a blank line.

console.log('test:', 10);
console.log();
from js2py.pyjs import *
# setting scope
var = Scope( JS_BUILTINS )
set_global_object(var)

# Code follows:
var.registers([])
var.get(u'console').callprop(u'log', Js(u'test:'), Js(10.0))
var.get(u'console').callprop(u'log')
pass

@SpencerPark
Copy link
Contributor Author

Woops, I guess the print function wasn't being imported. With a single argument it is still the keyword with a single option wrapped in extra parentheses. I'll fix that. Glad you've got ci setup :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant