Front-End

Replacing Local Storage with IndexedDB

When you build a PWA, you often have to store data locally. The easiest way is to use LocalStorage. Data persists even after ending sessions and it does easy synchronous read-write operation. Although you need to convert a JSON object to string because LocalStorage only supports string, the programming overhead …

Front-End

Unit Testing Event Listeners on Form Input Fields with Karma

Karma is a JavaScript test runner where you can run your unit tests on headless chrome or real browsers. Because it runs on the real browser, it supports the browser web APIs and makes it easy to test front-end JavaScript. With Karma, the environment where unit tests run is truer …

Front-End

Creating a Form for Screen Reader Accessibility

Web accessibility is becoming more and more important these days. If you are not used to implementing web accessibility, it sounds difficult. In reality, making website accessible takes only a little bit of effort and knowledge. HTML 5 supports a lot of accessibility functionality if you use the correct tags …

Sitecore

Dependency Injection Lifetime Management in Sitecore

Sitecore 8.2 and above implements dependency injection based on ASP.NET Core DI. Service registration is handled by using the IServiceConfigurator interface. When we opt for third-party DI modules like Simple Injector, you can have your own customised scoped lifetime. This post is a quick reference for service lifetimes when you …

Sitecore

Implementing Dependency Injection in Sitecore

There are a few different ways to implement dependency injection in Sitecore. Once upon a time, the only way to implementing DI was to use third-party libraries like Simple Injector. Since Sitecore 8.2 release, Sitecore includes build in dependency injection based on Microsoft’s Dependency Injection for ASP.NET Core. We can …

Front-End

Tips on Creating Android App from PWA

Progressive Web Apps (PWA) is a game changer for Mobile app development. We can turn our web page into a mobile compatible app with a little bit more effort. Create a manifesto file and write a service worker logic, then your website is a mobile app. Once you create PWA, …

Front-End

Why Address Bar Is Not Hidden – Android App with TWA

Ok, I created my Android App by using Trusted Web Activities (TWA). I tested my app on the emulator from Android Studio and it looked all good. The app worked fine in the full-screen mode. I published my first PWA app at Google Play and everything looked fine. When I …

Sitecore

Sitecore 9 Certified Platform Associate Developer Exam Prep Quiz

If you are going for Sitecore certification exam, this exam prep app can help you to pass the exam. It is a micro-front end made by Preact X and TypeScript and the bundle is hosted in GitHub Pages. Source code for this app is here. (1) Quiz Component (2) On …

Node.js

Node Module to Retrieve Multiple Parameters from AWS Parameter Store

I created a node module to retrieve multiple parameters as the parameterName-parameterValue Json object from AWS Parameter Store. It is called aws-ssm-parameters and is available from Npm. The module is namespaced. So, you need to add the namespace @mdhnpm when you install it. npm i @mdhnpm/aws-ssm-parameters The main motivation for creating …

Sitecore

Creating DbItem with Item ID – Sitecore FakeDb

With FakeDb, we can mock content items. Each tree node can be created by the DbItem class. DbItem class has three constructors as below. public DbItem(string name); public DbItem(string name, ID id); public DbItem(string name, ID id, ID templateId); When your code is calling GetItem with the Sitecore.Data.ID object, you …