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

Identifier 'console' undefined #123

Closed
dennisdrew opened this issue Jan 24, 2019 · 4 comments
Closed

Identifier 'console' undefined #123

dennisdrew opened this issue Jan 24, 2019 · 4 comments

Comments

@dennisdrew
Copy link

dennisdrew commented Jan 24, 2019

I get this error when attempting to do a simple console.log call.

After reading Duktape documentation, I see that it does not provide a console implementation. Is that true for duktape-android? If so, can we provide a console implementation?

@JakeWharton
Copy link
Collaborator

Seems fine. You can always delete it or reassign it to no-op. Want to send a PR?

@ghost
Copy link

ghost commented Feb 1, 2019

You could also create a console implementation in java/kotlin and then bind it to the engine. It depends where you'd like console.log to go.

@Shuijwan
Copy link

Shuijwan commented Feb 28, 2020

you can implement console like this.
@keep
interface Log {
void log(String msg);
void error(String msg);
void info(String msg);
void warn(String msg);
void debug(String msg);
}

Log log = new Log() {
@OverRide
@keep
public void log(String msg) {
//your implementation
}

        @Override
        @Keep
        public void error(String msg) {
            
        }

        @Override
        @Keep
        public void info(String msg) {
        }

        @Override
        @Keep
        public void warn(String msg) {

        }

        @Override
        @Keep
        public void debug(String msg) {

        }
    };

duktape.set("console", Log.class, log);

@JakeWharton
Copy link
Collaborator

We support console on HEAD and will be in the first Zipline releases.

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

No branches or pull requests

3 participants