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

Cannot use DUMP (--) debug facility without ReplPad Console #73

Open
gchiu opened this issue May 6, 2019 · 2 comments
Open

Cannot use DUMP (--) debug facility without ReplPad Console #73

gchiu opened this issue May 6, 2019 · 2 comments
Assignees

Comments

@gchiu
Copy link
Collaborator

gchiu commented May 6, 2019

HTML

<div id="app">
        <span title="message">
        Some text
        </span>
      </div>

Rebol

<script type="text/rebol">
  js-trace on      
  result: js-eval {document.getElementById("app").innerHTML}

  !! result ; this works

  -- result

</script>

Gives error:

JavaScript /AWAITER can only be called from rebPromise() inside script tag

@hostilefork hostilefork changed the title JavaScript /AWAITER can only be called from rebPromise() inside script tag Cannot use DUMP (--) debug facility without ReplPad Console May 19, 2019
@hostilefork
Copy link
Owner

@gchiu - I'm assuming your intent here is to write to the JS console, since you're making your own page and not running from Replpad?

Because the -- is trying to write to the Replpad console, not the JavaScript console. (e.g. it is using WRITE-STDOUT). Because of the way things work, that has to be done inside of a reb.Promise().

But we might set up DUMP/-- to write to the JS console if it doesn't have a Rebol console available. Or maybe this could be configurable? It could be that it could use WRITE-STDLOG instead of WRITE-STDOUT...and then you could define whether you wanted the output to go to the JS console vs. the Rebol one?

@hostilefork
Copy link
Owner

There's actually two issues here:

  1. -- is super useful, and one might want to use it even if one doesn't have the ReplPad loaded.

  2. Practically speaking, even if they aren't console-based, the script snippets people will be wanting to write in <script> tags will likely look like code you would do from today's ReplPad. That means they'll be assuming they can read URLs or do other synchronous things.

If (2) is true, that means we have to be running the <script> code inside of a reb.Promise(), instead of how it's currently being done with reb.Elide().

I've gone ahead and done (2) ...just because it seems like odds are nothing too useful will come of Rebol code that isn't being called directly from JS that can't run awaiters.

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