Comments (5)
@NduatiK you can do this:
if HTTPPort.in_use?(default_port) do
kill? = Kino.Shorts.read_checkbox("Kill port 4000")
if kill? do
HTTPPort.kill_process(default_port)
else
Kino.interrupt!(:normal, "Port 4000 is taken")
end
end
Since you start the LVN server in the notebook, it would make sense to pick a more random port, so it's much less likely that people run into conflict :)
from kino.
At first I am 👎 because if you need to perform such tasks, it means you are generally unable to reevaluate the cell in the first place? Can you provide a more concrete example? Who is using that Port? Where and how was it started?
from kino.
Sure thing.
I mean that there is a system process somewhere that is making use of the HTTP port (not Elixir port 🙃).
Let's say that a new Elixir developer has run mix phx.server
from their terminal.
If they attempts to start one of LiveView Native's tutorials, we would like to tell them that the default port used by LiveView Native (4000) is in use and offer to kill the system process holding the port.
The idea is that to block the execution until that system process is killed, and to offer the user a way to kill it.
Kino.interrupt!
currently lets us block execution if some condition is not met. It would be nice to be able to execute some code before attempting to reevaluate the code.
from kino.
Another use case would be in allowing developers to specify potentially destructive actions that needs confirmation.
For example, imagine we are using a Livebook app to send out daily emails.
In general we might always allow emails to go out. But if we detect that a user is sending the second email of the day, we might want to them to confirm that they really do want to send it.
from kino.
@jonatanklosko, we came up with a similar workaround, but yours is much cleaner.
Thanks!
from kino.
Related Issues (20)
- Postgre columns of type array can crash SQL smart cells.
- Support `:list` in Kino Table
- Feature request: Multi-select HOT 2
- Refactoring DataTable assets
- Allow Kino.DataTable to be updated
- Rerender an input will make it losing focus HOT 1
- Expand tuples in Kino.Tree by default HOT 7
- Update to Glide Data Grid v6
- Reevaluating a cell containing Kino.start_child! sometimes errors with "Already started" HOT 5
- Kino.Layout.grid hangs forever when you pass another Kino to it HOT 1
- Kino input field not appearing (bug?) HOT 1
- Add a process tracing JS.Live widget
- Add Kino.LiveFrame HOT 1
- Add clients monitoring
- Custom Message in `Kino.Process.seq_trace` HOT 2
- Sortable columns for Kino.DataTable
- Add Kino.Hub.on_join HOT 13
- Trouble Switching Tabs HOT 1
- We really miss this feature. Maybe we'll reopen an issue HOT 2
- Issue with Kino.JS.Live.Server.init/1 not shutting down properly HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kino.