Archive for January, 2017

Polymer Runtime Application Configuration

When creating web applications, we often need to have some parts of the application configuration for the deployment environment – usually web service API endpoints have different URLs in different environments, such as using a production web service in production and a locally hosted web service during development.

Such a feature is implemented in many web frameworks and building tools for web applications, such as Gulp or Grunt. Unfortunately, when building applications using Google’s Polymer SDK, there are no such features available – reviewing the Polymer documentation one, there isn’t even any mention of how one handles such mundane tasks as configuring API URLs, except hard-coding them(1).

Developers have tried to solve this problem in different ways, from adding “environments” feature for Polymer’s internal build tool; abusing “behavior modules”; or using “app globals” custom element with complex code to share application-level state. None of these features work well or elegantly (except maybe the environments feature, if it ever gets implemented).

Here is the solution I came up with – with many thanks to Daniel Tse that described part of the implementation in this article – just using the core Polymer elements iron-ajax and iron-meta and without any custom code. Its not the most elegant thing that can be done, but it is relatively simple and works well. Its main down-side is that the application configuration is not embedded in the application during build time but loaded from an external file when the application loads – this may even be a required feature in some scenarios but its not the generally accepted practice.

(more…)


  1. all iron-ajax examples, as an obvious example, use hard-coded URLs []

מתכון: קציצות עוף וסלרי ברוטב סלרי חמצמץ

מסתבר שאין לי פה מתכון לקציצות עוף, סוג של קציצות שאני די מחבב, אז הנה משהו שערבבתי לי לאחרונה. הרוטב היא קצת חמוץ וכדי לאזן את זה – גם קצת מתוק, אז תשימו לב. בנוסף הכמויות הן לדי הרבה אוכל – אני מכין בד”כ לשלושה אנשים ואוהב שנשאר לקחת לארוחת צהריים במשרד, אז קחו את זה בחשבון.

(more…)


Spam prevention powered by Akismet