Phoenix LiveView Tutorial: Handling Connection Errors And Push Notifications With JS Hooks

Phoenix LiveView Tutorial: Handling Connection Errors And Push Notifications With JS Hooks

Did we ever say we were going to use Phoenix LiveView to build a Messenger app with no JavaScript?

We lied. This time, we're going to tell you why, how & when you can and should kick in with your JS magic when using Phoenix LiveView.

It's been a while since we added Phoenix PubSub and user authentication with Pow to our Phoenix LiveView-based instant messaging app... but there it is, the long-awaited next part of our LiveView tutorial!

Read more...

Async vs Defer - Which Script Attribute is More Efficient When Loading JavaScript?

Async vs Defer - Which Script Tag is More Efficient When Loading JavaScript?

JavaScript is the most popular language in the world. Why? Because its the only well adopted language supported by a Web Browsers that brings dynamics to frontend experience.

Because of that, almost any web application requires from developers to write at least a bit of JavaScript code. While it's not a problem (unless you hate this language 😉), some of us tend to create very complex, frontend heavy applications that load.. well, definitely not fast.

In this article, you'll get familiar with async and defer - two attributes that will speed up your website speed rendering.

Read more...

Phoenix LiveView Tutorial: Bootstrap Your Messenger App

Phoenix LiveView Tutorial: Bootstrap Your Messenger App

We're back with the first practical part of our Modern Talking with Elixir series, and this time we'll get the initial setup for our Phoenix LiveView-based Messenger app up and running.

We'll prepare our app for Phoenix LiveView and install all needed dependencies, design the app's Ecto schemas, related contexts, and database structure, to accommodate for the app's business logic.

To learn even more about how we'll build our Messenger app and get deeper into Phoenix LiveView, subscribe to our newsletter and await further episodes of the series!

Read more...

Elixir Trickery: Using Macros and Metaprogramming Without Superpowers

Elixir Trickery: Using Macros and Metaprogramming Without Superpowers

There's hardly any more misunderstood element of Elixir than its metaprogramming power. The way to understand it is actually not to try too hard to wrap your head around it.

Elixir is a language heavily relying on its macro mechanism, which is both powerful and limited, and both complicated and simple, at the same time. The good news is that when you get to know the simple part about it, it's very easy to start writing macros even if you're a complete noob - and I'm going to give you plenty of examples to demonstrate that.

Read more...