Skip to content

Cadmus

Compare
Choose a tag to compare
@Javiani Javiani released this 09 Apr 16:05
  • Adding namespace support for public methods. It's now possible to discriminate which component should respond to an event method calling.

It is specially usefull when you have more then 1 component in the same markup, and both has methods with equal names.

In this example, box and view components has .update() public method. To distinguish which one should respond to a method call, you can use namespaces.

<div class="my-component"  data-component="box view"></div>

controller.js

...
var component = this.x('.my-component');

component('box:update'); // Should execute .update() from box component
component('view:update'); // Should execute .update() from view component

component('update'); // Should execute .update() from both components
...