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

How to pass command line arguments dynamically #175

Open
sheu opened this issue Mar 15, 2023 · 1 comment
Open

How to pass command line arguments dynamically #175

sheu opened this issue Mar 15, 2023 · 1 comment

Comments

@sheu
Copy link

sheu commented Mar 15, 2023

According to you documentation, one can pass arguments as follows

<code args="1 2 3">
/*
Your code here
*/
</code>

However, I would like to command line arguments dynamically. In my case I have an application where the users enter inputs and the code will be run against these inputs. So I would like to pass those inputs and command line arguments.

For the purpose of this question, the input will come from another textbox in on my page.

@nikpachoo
Copy link
Contributor

nikpachoo commented Mar 16, 2023

Hi @sheu!
The widget does not support changing command line arguments dynamically.
In this case, you need to recreate the widget with new parameters.
Something like that:

let instance;

initPlayground(element, theme) {
  if (instance) {
    instance.destroy();
  }

  playground(element, {
    getInstance: playgroundInstance => instance = playgroundInstance,
    args: '1 2 3'
  });
} 

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

2 participants