Vue.js: why event bus is bad idea

In February 2019 I wrote a post about global event bus in Vue.js. It’s a pattern to achieve very common thing: transform data not only from parent to child components, but also in reverse order. Event bus allows us to also emit events from parent to children and simply use methods for them. Unfortunately, because of many reasons, it isn’t good pattern and we should avoid it, if there are more possible options to use. After year and a lot of new experiences I can say: event bus is antipattern and should be avoided.  Why? In this short post, I will try to explain this in the simplest way I can. Of course, I open for discussion about that, so feel free to comment and write about your experiences.

Continue reading “Vue.js: why event bus is bad idea”

Polar Vantage M – review

Polar Vantage M

As you can see on my blog posts, sport is important part of my life – I will write post about this, about big changes in my life, but not now. This post is a Polar Vantege M review – sport watch, which I’ve used from middle of 2019. In effect, it’s long-term review and have information about many, many updates pushed by Polar during last few months. This watch replaced few other devices: my Garmin watch and Bryton Rider bike computer. In short version I can say, that I’m very happy with Vantage M, but it’s not perfect device and not for everyone. If you are looking for nice training device, this post may be for you.

Continue reading “Polar Vantage M – review”

Vue Vuex: reset store state to default / initial

Vuex is amazing tool for Vue, and I’ve already written a post about one of its adoption in web application: to avoid multiple ajax requests from many component instances. Of course, there are many, many options how to use Vuex in our app, and the most common is standard store with modules data. It’s great, but there is one important problem: default state and option to reset state. Vuex doesn’t have build-in option to reset state to default, defined in store declaration, so many users write additional commits and mutations for that, or one, which copies the same props as initial state. It’s ok, but means, that we must duplicate the same code, and if we want to change initial state, we must also change reset method.

Continue reading “Vue Vuex: reset store state to default / initial”

JavaScript ES6: string interpolation

JavaScript Test

This small post is next about very nice ES6 features, next to post about arrow functions in JavaScript. In many cases we must concat many strings with variables in JS or other languages. For example to inject some data, URLs, names, params or just for display something on page or app. In the past, we have to use plus operator and concat everything in very, very messy way. With ES6 we can stop doing this and use strings interpolation. Similar to, for example PHP, we can put variables in the same line without additional operators. Please look at small examples.

Continue reading “JavaScript ES6: string interpolation”

Bieg Charytatywny dla Karoliny

Bieg Charytatywny dla Karoliny

It was charity run in Legnica, one of the biggest cities in Lower Silesia, Poland. We ran to help Karolina – 24-years old, she has a cancer and fight to live. All proceeds from the registration fee were allocated to her treatment. Run was very nice: on city park of Legnica, and for me, very, very fast: I made my personal record. Absolute speed was a little smaller than on last run on Polkowice, but there was longer distance, so, it’s progress.