Advanced features

Like any other framework, Akili has some nuances that you better get to know.

Isolation

Proxy mechanism using entails some issue. When you change the scope value, all expressions in the templates will be changed at once. It is a complex operation. For example if you change many variables at once in a loop with a large size of objects and arrays, you can experience a noticeable slowdown of the application.

In order to avoid this we isolate the maximum number of functions. Isolation means that any changes in the scope will happen at the end of the function.

class MyComponent extends Akili.Component {
  created() {
    this.scope.data = [];

    Akili.isolate(() => {
      for(let i = 0; i < 100000; i++) {
        this.scope.data.push(i);
      }
    });
  }
}

The example above just illustrates how you can use it. In fact, we have already isolated all commonly used functions.

  • All component lifecycle methods
  • All scope functions
  • All event handlers
  • setTimeout, setInterval, Promise