0.1.7 • Published 3 years ago

modrn v0.1.7

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Introduction

Modrn.ts (https://github.com/alexbfr/modrn) is a pet project trying to resemble a Framework like vue.js or react.js while only focusing on modern browsers and web technologies. Since the browser landscape has shrunk considerably, almost all browsers should be compatible as long as web components and ES6 are supported.

This started as an experiment to see if web components are able to replace the classical web framework approach of a virtual DOM, and also to further my knowledge of typescript and ES6/modern browser features.

Architecture

The approach in Modrn.ts is to use web components (aka custom elements) to render the DOM. Meaning there is no need to build and traverse a virtual dom.

Instead, Modrn.ts renders components directly and clones, updates and removes DOM elements without resorting to another abstraction in between. A component in Modrn.ts is created quite similar to other frameworks, but the HTML template is not parsed separately (or created by emitted code). It is created in a non-document attached DOM node instead, from which it is cloned as required.

Performance

There was no focus on optimizing performance yet. The variable substition code is particularly unoptimized. Nevertheless, the performance is right now broadly comparable to react/vuejs, at least in the synthetic benchmarks under /examples/performance.

So?

Since this is an ongoing experiment, there isn't much of anything aside from code yet. But to provide something to feel and see, and to compare against other frameworks, there are a few examples shamelessly copied from the Vue.js examples:

elastic-header example

github-commits example

todo-mvc

All of those examples work exactly the same as the Vue.js examples, to the best of my knowledge.

Code

Interesting bits: