SQLite3 with vanilla JavaScript and OPFS - Hello world

In this post I will show you how to use SQLite3 directly in the web browser using the original C library through WebAssembly and OPFS to store the database. In this way we will have original SQLite3 on the web to work in the browser with JS on the client side. We can do this with pure JavaScript or with any framework; but I will show you a basic and well explained example of SQLite3 with vanilla JavaScript. Then I’ll show you an example with Tailwind, Svelte and Progressive Web apps. ...

August 8, 2023 · 6 min · 1086 words · Parzibyte

Passing parameters to Svelte function

In Svelte we can define functions that are going to be called when an event is triggered. For example, to call holaMundo on the click of an element we can indicate it as on:click={holaMundo} Sometimes it is necessary to pass parameters to that function inside a Svelte component, but we cannot indicate it like this: on:click={holaMundo(parameter)} Since that will execute the function as soon as the component is loaded, and won’t wait for the click. In this post I will show you how to pass arguments to functions in Svelte without calling them automatically. ...

June 28, 2023 · 3 min · 521 words · Parzibyte

Print receipt in thermal printer using JavaScript, CSS & HTML

In this post I will show you how to print a ticket or receipt by using JavaScript (client side) and a thermal printer. At the end we will have a great ticket that looks like this: Obviously you can change the font family, size, logo and so on. And remember: we will be using only pure CSS, HTML & JavaScript, no frameworks; though you can use any framework to render the content before printing. You can see the demo here, and the full code on my GitHub. ...

October 10, 2019 · 3 min · 596 words · Parzibyte