Seems like MediaRecorder (https://developer.mozilla.org/en-US/docs/Web/API/MediaRecord...) is the standard API to record the screen, it takes a video format during setup, and then `recorder.requestData()` will give you the raw bytes for your format of choice when you're done, ready to download and save or do whatever with. Web standards do a lot of heavy lifting for you nowadays!
I'm really excited to see further development and use of Svelte. I develop both Vue and React front ends (both have their strengths and weaknesses) and Svelte is a breath of fresh air. I'm not saying Svelte is _better_, but I am enjoying It's approach a bit more.
Definitely still in the camp of thinking it's the next big thing. In my experience, Svelte does a great job of just getting out of the way and letting you start coding.
The ecosystem isn't there yet, and I probably wouldn't try to use it in a work project. For my personal projects though, I use it for everything front-end. More than that - I've stopped making desktop apps and just default to using svelte instead.
Happy to answer any specific questions you've got! Bottom line - given the opportunity, I will use Svelte.
I'm not a frontend developer, but absent svelte, the next easiest thing to develop is a full on desktop application (easier than some other frontend web framework)?
I haven't done Svelte but in general I find native is easier than web UI. The tools and libraries just did more for you 20 years ago than any web framework does today. Web frameworks (Svelte included) just keep reinventing the wheel without giving you a second one.
I'm a web developer and I like the power and flexibility it has compared to native GUI development but I think a big problem is we now have an entire generation that doesn't even know what they're missing.
That's interesting. I've done a lot of Qt and GTK development, but it was always a pretty miserable experience. Notably, GTK builds on GObject, which is just a bunch of hacks to emulate object-oriented programming in C to no discernible benefit. Similarly, Qt was (presumably still is?) its own language atop C++, and you needed a special compiler to compile it into vanilla C++. Additionally, because C and C++ build systems are so very terrible (no standard tooling, no dependency management at all, certainly no reproducibility, etc etc), managing projects in these languages was utterly terrible (nowadays I understand that CMake has built-in support for Qt, which speaks to the sadness of the build ecosystem that the build tool has to have first-class knowledge about individual libraries and frameworks). Of course, there were bindings, but bindings never adequately masked the complexity of the frameworks, and with respect to memory management you now had to understand in detail how these frameworks' memory management conventions integrated with the host language's garbage collector or you would see your Python (or whatever) application segfault. And yes, I tried Vala and Gnome's JavaScript offering and everything else available at the time.
I'm guessing that the Windows and MacOS frameworks were less hostile, but it seemed like the web was surely ideal, at least in the last several years. Sure, you had to learn a web framework to build simple applications, but you could at least use a high level language with a reasonably sane package manager (for those who haven't developed in C or C++, it might come as a surprise that JavaScript and NPM are "sane" tools) and a reactive programming model.
I guess I'm not sure if my expectations for web development are too high or if GTK and Qt are especially bad representatives of native development.
> I've done a lot of Qt and GTK development, but it was always a pretty miserable experience.
I echo this sentiment, with the exception of Delphi circa version 5-7, though that's probably through rose-tinted glasses since I had just come off trying to make Win32 UIs using MASM. GUI development has always been a crapshoot of learning esoteric bugs masquerading as features. Windows and MacOS UI development is no different, just more locked in. At the very least the web is somewhat consistent between platforms.
Until they solve https://svelte.dev/faq#how-do-i-test-svelte-apps and the ecosystem matures a little (Sapper -> svelte) I wouldn't recommend using it for any production applications. I
do currently use it for PoCs since it's easy to spin up and be productive quickly.
As someone who’s been recently doing front-end dev work full-time the question below it is also a little triggering. “Is there a router?” Not an official one but they list like 6 alternatives, two of which are apparently “very similar”.
The JS ecosystem’s penchant for giving you small components that you have to choose individually and then glue together can get a little exhausting. Hopefully the library whose approach you prefer has decent documentation, keeps up with changes to svelte, doesn’t get abandoned, etc.
Edit: apparently Sapper is a Next.js like framework that provides all the components you need for svelte in one package. Someone else said on this thread it’s eventually getting deprecated by the svelte team’s own thing called SvelteKit. Not ideal, but at least they’re working on something more integrated.
They also don't have an answer for error handling. You can't catch them with Sentry, you can't catch then to handle them, and when they happen your app just freezes.
I didn't see any updates to the issue with lots of people complaining about svelte halting unrecoverably on errors instead of allowing error handling (thus also reporting), so no, Sentry isn't working fine in Svelte.
We've switched to Svelte for new projects at work, from React. It feels like a significant improvement, especially regarding unnecessary complexity and verbosity. The UI component libraries for Svelte are still lacking in maturity, that's the one drawback I can think of.
> It feels like a significant improvement, especially regarding unnecessary complexity and verbosity.
> The UI component libraries for Svelte are still lacking in maturity
The typical counterargument usually made at this point would be "those two points are related" (to paraphrase Bjarne Stroustrup: "every ship gets barnacles as it ages").
So let's anticipate that: do you have any reasons to believe that Svelte will avoid adding accidental complexity/verbosity to it as it/the surrounding ecosystem matures, and if so, how do you think that will be mitigated?
> to paraphrase Bjarne Stroustrup: "every ship gets barnacles as it ages"
Enough time has passed to firmly conclude that Stroustrup was wrong on that point. Other languages have withstood the test of time better than C++<11 and C++>=11 has dramatically improved the language by copying features from those other languages. C++'s issues were poor design choices, not simply some "maturity" force that causes a language to accumulate incoherent features.
I really like it. Replaced Vue with Svelte and things have been great so far. Smaller bundles, and much lighter components. Built-in state management is very handy.
The initial pages are Go templates which are hydrated with Svelte components. It took a bit of trial and error to get the flow right so that I don't have to write double the code.
I don't know if it's the next big thing or not but it works really well for me.
> The initial pages are Go templates which are hydrated with Svelte components. It took a bit of trial and error to get the flow right so that I don't have to write double the code.
What is the advantage of doing this over using http.FileServer to serve html which imports your svelte generated javascript directly ?
Are you using Svelte in a part of your application instead of the entire application?
I wanted the initial render to be fast, and Go templates really shine there. Since the site has a lot of moving parts, there are many components that get hydrated depending on the page. For instance, this page (https://gurlic.com) is generated by Go, but the actions such as like/dislike/share/respond are hydrated by their respective Svelte components. If you scroll all the way down, new posts are fetched and rendered with Svelte components too, and the great bit is that I can use the same action (like/dislike/etc) components there.
Maybe there's a better way to do it, but I like writing smaller components that can replace initial server-rendered HTML, and can then be imported into larger components.
I think this is the next leap in web UI development on the same level as jQuery, React and Vue.
I've used React, HyperApp and Flutter and Svelte (with Tailwind for CSS) is in my opinion clearly superior. But I also know someone who thinks Flutter is better.
Having used Tailwind on two projects now, I do find that the class strings are "write only". One tip that helps is to write the classes from "outside in," e.g. first the margin, then the border, then padding, then properties affecting the inside of the element…
I recently gave it a try and it generally feels nice starting out, but I started running into rough edges pretty quickly, enough that I don't think I would want to build a large app using it. Main complaint is how it handles styles, it does not allow you to apply styles to the edge of a component without doing one of several workarounds, all of which have downsides. Means it's very hard to create a set of generic styled components and then apply layout to them using a parent, which makes it a bit of a pain to reuse things, which is kinda the point of component based libraries.
I also get the feeling that the Svelte maintainers do not particularly care what the community wants and are building what they want, which is totally cool, but unfortunately I disagree with a lot of their choices so I guess it's not for me.
Still in the next big thing camp myself, also. Of course, there are the noted drawbacks, but for our use case: putting a library of UI components across a handful of app stacks (.NET, asp, Angular, etc) - Svelte is the solution.
We have faced the usual wild west frontier situations where nobody really had an answer for something we wanted to do, but we have worked out solutions without a huge deal of frustration.
And it's important to mention that the development and maintenance experience of Svelte is very pleasant.
I've been converting my massive Vue 2 application to smaller "micro front-ends" written in Svelte/Sapper. For some reason I just feel it's faster to write in Svelte than it is in Vue 3, and these are all in production. But we're a tiny startup and I'm the only developer so...
I wouldn’t use it for big commercial projects because the ecosystem isn’t very big (ie I wouldn’t build a b2b saas app with it) but for small projects and side projects it’s great.
Here's my general thought, in a year we will all be singing the praises of something else, and my fellow webdevs will continue to mistake "different" for "better".
I enjoy writing in Svelte more than using React. I like the concept that the output doesn't contain the actual library. I think testing tools is a must have though otherwise it will just be for my personal projects.
Looking forward to SvelteKit - I don't care for TS though.
Can I use svelte as an alternative to nuxt.js? I want to create a simple website where most of the content is written in markdown, that is rendered to static html (that can be hosted on e.g. netlify).
As it is kind of a hobby project, might as well learn the next hot thingg? Is Svelte suitable for these kind of applications? Some of the features of nuxt.js that i like: content module (put some markdown files in a folder and the routes, write a template and then all the html rendering etc is all taken care of) extensions for image resizing so images are resized to multiple resolutions as part of the build process, hot reloading in development
Thanks! Too bad SvelteKit is still in beta, cause I don't feel inclined investing any time in Sapper now I know that that is going to be deprecated. Guess I'll have to be brave and try it out
My "blog" (HR bait really) is exactly such a thing(using Sapper), but I had to integrate the markdown->html library by myself, I don't resize images and hit reload doesn't work.
So basically it's possible, put you have to put the thing together by yourself.
One minor nitpick: "strongly typed" is not very meaningful. "statically typed" (or just "typed") conveys the intended meaning much better, since it has a clear definition.
Anyway adding proper support for TS sealed the deal for me - Svelte itself might never reach mainstream adoption but the idea of having a framework-compiler is something that I hope will, since it retains all the advantages of alternative approaches without introducing any significant disadvantages.
"Strongly typed" and "statically typed" are not synonymous. Yes, SvelteComponentTyped is statically typed, but that's somewhat implicit (and irrelevant) here. What they're referring to in that particular sentence is ease of strong typing. Static typing is a separate thing.
That's true, but GP's point about how nobody really agrees on what "strongly typed" means still holds up.
It might be worthwhile to frame it as "static and strongly¹ typed" with a footnote expanding on what "strongly" means to the svelte developers, just to get everyone to agree what we are even talking about in the first place.
I'm not sure I'd agree that nobody agrees on what "strongly typed" means (yes I understand that sounds like an oxymoron but bear with me).
I think the confusion around the term mainly arises from people in computer science having a strong ;) preference for binary definitions. To be able to say "X is strongly typed" and "Y is not strongly typed" is desirable.
However, linguistically, "strong" and "weak" are not binary terms. Static is: something is static or is not. But strength/weakness is an assessment on a scale. Defining something as "strong" is always, by definition, relative and somewhat subjective in nature.
That isn't to say that the definition of "strongly typed" is subjective; we can find agreement on what scale "strong types" live upon. But the application of the term to any given object is subjective. We cannot say "X is strongly typed", we can only say "X is more/less/very/not very strongly typed".
> That isn't to say that the definition of "strongly typed" is subjective; we can find agreement on what scale "strong types" live upon. We cannot say "X is strongly typed", we can only say "X is more/less/very/not very strongly typed".
I agree with your overall argument, but in this conclusion I subtly disagree: it implies that we could come up with some linear quantitative scale from 0 to 1 of how strongly typed something is. I don't think we can, it's a composite of qualitative features that defies that approach.
It might even be a somewhat rock-paper-scissors like kind of thing where also we cannot really value each feature because their positive or negative value greatly depends on the presence or absence of other features.
Strongly typed is meaningful and has a real definition, but it is used incorrectly here. Strongly typed means that invalid runtime types result in invalid programs...which can actually be true for both static typed languages (like Rust or OCaml) and dynamic typed languages (like Python, which throws errors on invalid types).
Typescript is statically typed but it is also weakly typed. Types are validated at compile time, but they do not prevent you from using invalid types at runtime.
1. Open standards. There is no one entity to control what frameworks are "standard". Need for back compatibility of the web standards make them too simple and minimalistic. So you inevitably have a demand for power tools.
2. Many players are trying to capture demand for power tools. Of course their reasoning and approach differ. Often it becomes less about technology, but more about audience perception of the tool. Then we see more blogposts, podcasts, meetings, "see how easy to create and app" posts.
3. Web frontend is hard environment to model UX because too many moving parts. You have inherentedly stateful programm which should communicate asynchronously with at least 2 inputs-outputs: web server and user. Not speaking that it's not enough to have framework with proper building blocks to model your UX, you have bunch of issues with dependencies, debugging and integrations with existing tools.
This makes hard to come up with a solution which can satisfy many people. Some people are infiltrated with ideas which are incompatible with particular framework ideology, and bam, you have 2 camps which "push" against each other.
Now you have demand for tools, but tools shitty in some ways, and it's shitiness is covered with hype, brands and other forms of forming opinion.
This creates a demand for a new thing after people get disillusioned via own experience. And we get yet another framework. Repeat every 4-5 years.
JS front-end frameworks are born from ad hoc application architecture or from difficulty applying an existing framework to an application. The progenitor applications had different feature and development requirements, which is reflected in the varying frameworks.
While it may seem a plethora of frameworks exist, a few have most of the market share. That is not too far from the situation with other programming languages and framework types.
There are also old frameworks that have essentially been obsoleted but continue to stick around due to project inertia, the needs of legacy code, or marketing needs of the maintaining organizations.
Some people prefer FP. Some prefer OOP. Some need just a sprinkling of interactivity. Some need to build complex UIs. Some need to run on underpowered devices while others don’t. Some dislike too much abstraction. Some prefer it.
In short, we have a plethora of frameworks for the same reason we have a plethora of languages, sodas, beers, coffees, tools, products, novels, etc. Humans are messy.
"Can someone explain to me why we have so many programming languages?"
Different strokes for different folks. People are trying to make new things that solve what they think are pain points in previous approaches.
There really isnt "so many" frontend frameworks. React is the clear leader, with Vue and Angular trailing behind. Svelte is a bit more of an experimental/innovative thing.
There is quite a long tail of small/niche frameworks, but for most folks there aren't many major ones, really it's 3; React/Angular/Vue. There's probably another 5-10 in the next cohort, including Svelte
Wait, is this thing entirely client-side, in only 17.5 KiB? I know browsers can capture video frames, but how does it export it afterwards?
[0] https://vippet.netlify.app/