Oliver Nassar

Runtime Updater (JavaScript Class)

This class will grow over time, but it's purpose came from running this site on GitHub Pages. Specifically, I didn't want to have to update the year in the footer of each page annually.

So I came up with the idea for an all-purpose class who's responsibility would be limited to looking up elements and performing some basic modifications.

Right now, it's limited to searching for elements with the attribute [data-lookup="year"], and setting the current year.

But I'd like to extend it for the following use-cases:

It's been open sourced, and is available on GitHub.


Implementation Code

RuntimeUpdater.init();
RuntimeUpdater.updateYears();

Larger Concept

I wanted a small class that I could drop in, and plug-and-play various concepts such that a server-side parser isn't required.

I want it to be limited in scope, and essentially function to "update" pages at "runtime" 😉

Enjoy :)


References