Хөнгөн жинтэй десктоп аппликейшн хөгжүүлэх шинэ шийдэл: TinyJS

Published:

Энэхүү мэдээ, нийтлэлийг хиймэл оюун боловсруулав.

Програм хангамжийн инженер Тарвин Стро-Спайер жижиг хэмжээний десктоп аппликейшн бүтээхэд зориулсан JavaScript орчин болох TinyJS-ийг танилцууллаа.

Орчин үеийн ихэнх програм хангамжууд болон вэб хөтчүүд RAM санах ойг ихээр шаарддаг бол TinyJS нь macOS, Linux болон Windows үйлдлийн системүүд дээр 6MB-аас бага хэмжээтэй жижиг аппликейшн ажиллуулах боломжийг олгодог. Энэхүү хэрэгсэл нь өөрийн гэсэн UI давхаргыг үүсгэхийн оронд үйлдлийн системийн суулгагдсан вэб хөтчийн хөдөлгүүр буюу WebView-ийг ашигладаг тул ийм бага хэмжээтэй байх боломжтой болжээ. Тухайлбал, macOS дээр WebKit, Windows дээр WebView2, Linux дээр WebKitGTK-г ашигладаг байна.

TinyJS нь Electron фреймворкоос ялгаатай нь Chromium хөтчийн цөмийг аппликейшн бүрд дагалдуулдаггүй тул хэмжээний хувьд хамаагүй хөнгөн юм. Мөн хөгжүүлэгчид Rust хэл сурах шаардлагагүйгээр зөвхөн JavaScript, CSS, HTML ашиглан програмчлах боломжтой. Үүнээс гадна Node.js хамааралгүйгээр ажилладаг бөгөөд React, Vue, Svelte зэрэг фреймворкуудыг дэмждэг.

Одоогоор TinyJS-ийн “апп дэлгүүр”-т дэлхийн цаг, тэмдэглэлийн дэвтэр, Winamp хөгжим тоглуулагчийн хуулбар зэрэг 25 төрлийн аппликейшн байршсан байна. Эдгээр аппликейшн нь хурдан ажиллахаас гадна зөөврийн компьютерын эрчим хүчний зарцуулалтыг бууруулах давуу талтай гэж бүтээгч нь онцолжээ.

Дэлгэрэнгүйг эх сурвалжаас харах

↓Эх сурвалжийг нээх ↓

As the world’s billionaires anxiously plot datacenters to run trillions of lines of AI-generated slop code, one software engineer has zagged in a completely different direction: building an ecosystem for writing and running small apps that run on desktop computers, like it was 1992 all over again. Self-described “maker of things” Tarwin Stroh-Spijer has created a JavaScript runtime, called TinyJS, for making very small applications (many occupying ~6MB or less on disk) for macOS, Linux or Windows. To be clear, TinyJS is not a “no code” framework with hobbled capabilities. It offers the full programming power of JavaScript, along with the visual rendering and communication capabilities of the underlying OS. The trick to TinyJS’s frugality is that it uses the WebView window of each OS, utilizing the built-in browser engine to visually render the app, rather than implementing a UI layer from scratch. It uses WebKit to run apps in this fashion on macOS, WebView2 for Windows, and WebKitGTK for Linux. TinyJS’s approach is starkly different from using the Electron framework, which bundles a Chromium open source browser core with each desktop app. But whereas Electron promises an identical look-and-feel of an app across all platforms, TinyJS apps will have slight visual variances when run on the different platforms, owing to minor differences in how each OS’s rendering engine works. The Electron app pays for this cross-platform uniformity: with Electron, even the most basic application can weigh 150MB. Rust is not always the answer The core of TinyJS is txiki.js, an ultra-compact JavaScript runtime written by Saúl Ibarra Corretgé that makes Deno and Bun look like behemoths. The starter package is about 5.6MB and the launcher takes up another megabyte or so. The rest of the package is all developer code, basically. Stroh-Spijer also simplified the development process by using the OS’ interprocess communication mechanisms for handling data transfer, eliminating the need to bundle an HTTP server for each app, along with all the security headaches that entails. All coding in TinyJS is done in JavaScript, CSS and HTML – no compiling necessary. There’s plenty of room for creativity here, as web design capabilities have been growing by leaps and bounds of late. The Tauri project has a similar aim of creating the tiny apps, and can deliver a desktop app in 10MB, but that framework has some drawbacks, Stroh-Spijer noted on the TinyJS website. The main one is that you have to write applications in Rust – which requires learning Rust, among other drawbacks. Also, TinyJS hands over a lot of the app’s substrate to the OS – such as dialogs, menus, tray, clipboard, auto-updates – that with Tauri would have to be imported one plugin at a time. Developers don’t need Node.js as a dependency here, unless they want to run a framework that requires it, such as Vite. It can also support other JavaScript frameworks like React, Vue, and Svelte. Or it can run with no dependencies at all. You can also use TinyJS to wrap a Webpage, by pointing the window to a URL. Imagine having your favourite site as an app on your desktop. A shelf of diminutive apps With TinyJS, Stroh-Spijer created an “app store” that can be run, natch, from the desktop (the zipped Windows version can be downloaded here). As of press time, it indexes 25 sample apps he wrote. The example apps, all free, vary in utility and whimsy. The shelf includes a world clock (which ships as a 3.8MB zip file), a clipboard history app (3.7MB), a markdown editor (4.9MB), a desktop ghost (3.8MB), a SQLite browser (4.1MB) and, most impressively, a clone of the iconic Winamp music player, which demands only 7.4MB from your hard drive. Once you convince Windows Defender to trust the launcher, you can download and open the app of your choice directly from the shelf. In my tests, the copy-and-paste app, clearly written for Mac hotkeys, was still too buggy for Windows, though the world clock ran just fine and consumed only 15.5MB of RAM on my box. (Caveat emptor: the launcher checks the hash to ensure the validity of downloaded apps, though you’re trusting that Stroh-Spijer harbors no evil intent here). Or, just skip the examples and build your own test apps. Today’s personal computers are powerful, but there are still many good reasons for building apps that would be petite even by last century’s standards. Commercial applications (those still around anyway) and Web browsers are voracious RAM consumers, so adding more tools to the desktop with little overhead is a positive. Plus, unlike the bloaty apps, minuscule apps start fast, and, in theory, draw less power on laptops. And just like the TikTok meme of the woman who insists on bringing her dog on the plane because it’s just “a tiny dog,” users may want to add these apps to their desktops, because, well, they’re tiny. ®

Та юу гэж бодож байна?

Сэтгэгдлээ оруулна уу!
Please enter your name here

MFC.mn сайтад сэтгэгдэл оруулахад анхаарах зүйлс

Холбоотой

spot_img

Шинэ

spot_img