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
Feature Request: Interactive JavaScript Shell #195
Comments
That looks great, and a great addition to a-Shell! Thank you very much. I have a question: line 12 refers to |
See the comment above. It could definitely be used for user-customization. |
I need to clean this up (use tempfile library, etc) :). Closing the issue for now (I intend to re-open it soon!) |
Okay, thanks. I think you can use the environment variable |
Sorry if this should be obvious but the lines: |
Sorry!!! As I stated above, I need to clean this up! I copy-pasted this script from my |
This script's help text is currently somewhat inaccurate. See #197 |
Thanks a lot for this command. I'm going to copy and test this in a-Shell. |
It looks like multi-line input isn't working as expected...
should not produce a syntax error... Edit: This has been fixed. I apologize for re-opening this before having fixed several issues! |
The |
I can understand expert users wanting to run |
I would suggest the reverse! Commands run from
I was trying to mirror |
What I have in mind is:
It's not just about keyboard interaction, but also about not redefining keyboard input by mistake.
I see your point, but both messages are much shorter. Other interactive commands like |
I think the message is reasonably short. :)
I, previously, used |
I'm terribly sorry. In reading the code, I made a confusion between For the second point, you could either pass the non-recognized options sent to |
I made it Thank you for the feedback! |
Status update:
% var ss = document.createElement("div");
% ss.innerHTML = "This is 'a test";
// Command still not accepted (thinks quote is unclosed). |
@personalizedrefrigerator I would love that feature as well! |
a-Shell seems to come with prompt_toolkit! I might be able to use this to add auto-complete to jsi! |
That's because the expression evaluates to 'undefined'. I just checked, and the old version of 'jsi' does this, too. If the output of a command is 'undefined', we could, alternatively not print anything, but this makes expressions like window.thisdoesnotexist print nothing... Perhaps if an expression inputted by the user ends with a semicolon and outputs 'undefined', nothing should be printed. |
Ah, I see. It kinda makes sense, from JS point of view. function print(printString) {
window.webkit.messageHandlers.aShell.postMessage('print:' + printString);
} |
Status update
I've changed |
Status Update
|
Currently, variables defined using % let a = 6;
% a
Jsc: Error...
% var a = 12;
% a
12 A while ago, I wrote a solution to this (published here: https://github.com/personalizedrefrigerator/LibJS/blob/1d18cafa6503bc293b5ed5f592ba7ef2ec6266af/Libs/JSHelper.js#L206 ). I would prefer not to re-write it, so may include this file. |
In SceneDelegate.swift, I enclose the javascript code between curly braces: a-shell/a-Shell/SceneDelegate.swift Line 475 in e9dba50
This was done to avoid influencing the main WkWebView too much, which is not so much of an issue now that javascript is executed in a different webView. Would removing the braces help in this issue? |
I think so. |
I tried: even without the braces the issue is still present. |
To workaround the Of course, this means that const-ness for variables declared in the shell is not respected. The other approach mentioned above requires var codeToKeepAcceptingEvals = `
eval((await getNewCode()) + codeToKeepAcceptingEvals)`;
(async function() { eval(codeToKeepAcceptingEvals); })(); ) |
delaying things in the webView JS interpreter doesn't work as I expect in general, and it tends to treat the timeout delay as a suggestion more than a requirement. |
It looks like build 157 contains a version of Thank you so much for helping me with this! |
Yes, there are a few days of delay when uploading, plus a few days of delay when I forget to copy the latest version. I'd say the version of |
I think I'm satisfied with the current functionality of jsi, so (hopefully) am done making changes. Please let me know if there is anything you would like me to add! |
It would be great to have this in
a-Shell
! I'm not an iOS developer, so I'm not comfortable opening a pull request.The text was updated successfully, but these errors were encountered: