LightTable / Javascript

Javascript language plugin for Light Table
MIT License
56 stars 79 forks source link

`Window.prompt()` doesn't work #21

Closed kenny-evitt closed 8 years ago

kenny-evitt commented 8 years ago

This was, effectively, reported in this topic in the Google Groups group.

Chris Bourke wrote:

Maybe I'm not seeing it, but I can't find exactly where or why window.prompt support was removed (in light table 0.8.0 alpha and beyond apparently). I teach a course on JavaScript and have students use this as an early method for input. Versions 0.7.2 and prior supported this, but it no longer works. What was the justification? I tried several methods to restore it, but I've been unable to. Does anyone have any ideas on how to go about doing it?

On a similar note, I've got modules that rely on older lighttable versions' support of earlier ECMAScript standards (so they can add their own polyfill). Is it possible to set the script conformance version?

I replied:

This was a bit of a pain to find, but the Light Table team didn't explicitly remove window.prompt support – it's just a side effect of us migrating from using node-webkit (now NW.js) to Atom shell (now Electron). The changes for that migration were first relased with version 0.8.0 (including the 0.8.0 alpha release).

See this comment made by myself for an issue someone reported with the socket.io JavaScript library – Electron doesn't support prompt. The original link in my comment is broken now but I'm pretty sure Electron still doesn't support it.

I'm not really familiar with the JavaScript plugin but I think we're just use the Node.js that Electron provides to evaluate JavaScript. I don't think there's a way to eval JavaScript according to an older version of the standard.

I'm somewhat open to merging a PR that provides a prompt-like function for JavaScript users in Light Table but it should be available globally or maybe even as part of the Window global object, and it should behave exactly like the standard function:

kenny-evitt commented 8 years ago

This is really just a placeholder for anyone in the future searching for this info.

We can re-open this if anyone's interesting in submitting a PR to implement this.