Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing console.dump on ios... #326

Closed
enchev opened this issue Sep 23, 2015 · 6 comments
Closed

Missing console.dump on ios... #326

enchev opened this issue Sep 23, 2015 · 6 comments

Comments

@enchev
Copy link

enchev commented Sep 23, 2015

From @NathanaelA on September 19, 2015 8:6

I copied some code over from Android to ios; and found out the console.dump doesn't work. Shouldn't we take the same dump routine that is available on the ios and patch the console prototype to use it?

Copied from original issue: NativeScript/NativeScript#778

@jasssonpet
Copy link
Contributor

console.dump() isn't implemented in any of the following popular APIs:

IMO, if we want to support it on iOS, the same as we do on Android, we have to add the same implementation from the modules in the runtime, which is suboptimal and error-prone. I think, that the dump method (and any other custom one) should be added in the NativeScript modules, so that it can work the same on iOS and Android.

IMO, instead of modifying internal JavaScript objects we should replace the console.dump(obj) method with console.log(f(obj)), where f is something like util.inspect() in node.

Related to: #261

@enchev
Copy link
Author

enchev commented Sep 23, 2015

This issue was moved to NativeScript/NativeScript#805

@enchev enchev closed this as completed Sep 23, 2015
@fealebenpae
Copy link
Contributor

@jasssonpet we should use console.dir(), which is supported by the Inspector.

@jasssonpet
Copy link
Contributor

@fealebenpae console.dir() is an excellent method, but as said in the previous discussion, it doesn't work without the inspector. Sometimes you just want to use the terminal, and something like console.dump() would be invaluable.

@fealebenpae
Copy link
Contributor

@jasssonpet We can override the current ConsoleClient and implement stdout logging for dir, table, and some other methods. I'm willing to bet that util.inspect() in Node came about because of a limitation in the way v8 handles console.

@jasssonpet
Copy link
Contributor

I totally agree with this if we can, and we can change console.dir() for Android too to be on par with iOS.

But I think, that it would still be useful to have something like util.inspect() for dumping to a file or alert call.

BTW, node's console.dir() does pretty print objects on the terminal.

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

No branches or pull requests

3 participants