Angular Light + Object.observe

    Angular Light is a stand-alone client MV (C / VM) framework that is based on the ideas of Angular.js and Knockout.js, and looks like a simplified Angular.js

    A version of Angular Light 0.8 has been released that includes various improvements and fixes, major changes:

    1. Support for Object.observe and Array.observe , which can increase web application performance.
    Using Object.observe is an optional feature, it can also be enabled for individual Scope (scope trees). Browsers that do not support Object.observe continue to work through dirty-checking, you also need to know some nuances .

    Some spherical tests:
    Speed ​​of search for changes in scope, jsperf.
    The result can be seen in the picture above.

    Search for changes in arrays , in this test 2000 arrays, each contains 2000 elements, on the first pass there are no changes in arrays, on the second there is a change of 100 arrays. Sample results on my laptop:
    Dirty-checking: 35ms and 65ms
    Object.observe: 0.1ms and 1ms

    There is also a margin for this feature to increase performance, for example, the "digest" cycle can exclude those scope in which there were no changes, this can improve indicators are an order of magnitude (for tests above).

    Although in real applications the overall performance will not be so good because you can’t cover everything with Object.observe and some part will work through dity-checking, but for large applications, the profit can be noticeable.

    2. The ability to isolate Angular Light , this allows you to embed your application in other people's pages without "harm" - the page will not have any global variables from the application and the framework.
    It is also possible to use different versions of Angular Light on the same page, and create copies of Angular Light if necessary.

    3. Private directives, controllers and filters.
    For each scope (scope of the tree), you can set your own set of directives, make private directives. To do this, you need to make the variable $ ns in scope and add the necessary directives, controllers, filters there. Example

    4. Improved performance and memory consumption, increased test coverage, which has nearly 800 checks.

    Previous articles:

    Also popular now: