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

Stlite Sharing: auto-save/run-as-you-type feature #948

Open
whitphx opened this issue Jun 5, 2024 · 2 comments
Open

Stlite Sharing: auto-save/run-as-you-type feature #948

whitphx opened this issue Jun 5, 2024 · 2 comments

Comments

@whitphx
Copy link
Owner

whitphx commented Jun 5, 2024

No description provided.

@stevewillard
Copy link

This is a great library - thank you! Is there an API to update the code for a running stlite app? I'm able to mount code, and I have a monaco editor, but when I change the code and .mount again, I see the toasts, but the code doesn't change.

I noticed you have a save button here: https://edit.share.stlite.net/ and are able to detect code changes to reload the code. How can I do that?

Screenshot 2024-07-13 at 12 01 49 PM

@whitphx
Copy link
Owner Author

whitphx commented Jul 16, 2024

stlite.mount() returns a controller object that has some methods to install packages and manipulate files on the virtual file system after mounting the app.

const controller = stlite.mount(
  // ... options ...
);

await controller.install(["package1", "package2"]);

await controller.writeFile("path/to/file", "file content");

await controller.renameFile("old/path", "new/path");

await controller.unlink("path/to/file");

See the actual implementation for more details and available options.

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