Example component

HTML Markup:

<div data-fs-component="hello-world"></div>

Building our example component:

function MyComponent(params) {
  sauron.Component.call(this, params);
  this.element.innerHTML = "This is sauron";
}
MyComponent.prototype = Object.create(sauron.Component.prototype);
MyComponent.prototype.constructor = MyComponent;
js/components/my_component.js

Hooking it all together:

// Boostrap sauron and define your component map
sauron.util.ready(function() {
  sauron.instance({
    "hello-world": MyComponent
  });
});
js/index.js

Result: