How to use the hyperactiv.observe function in hyperactiv

To help you get started, we’ve selected a few hyperactiv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zgsrc / ibjs / model / container.js View on Github external
constructor(reactive) {
        super();
        if (reactive) {
            let _this = observe(this, { deep: true, batch: true });
            Object.defineProperty(this, "rule", { value: fn => computed(fn) });
            return _this;
        }
    }
}
github zgsrc / ibjs / lib / lang / context.js View on Github external
constructor(scope, defaultResolver) {
        Object.defineProperty(this, "resolver", { value: new Resolver(defaultResolver) });
        
        scope.$ = observe({ }, { deep: true, batch: true });
        scope.observe = observe;
        scope.rule = computed;
        scope.context = this;
        
        Object.defineProperty(this, "scope", { 
            value: new Proxy(scope, {
                get: (scope, name) => (name in scope) ? scope[name] : scope.$[name],
                set: (scope, name, value) => {
                    if (!(name in scope) && scope.$[name]) scope.$[name] = value;
                    else scope[name] = value;
                    return true;
                }
            })
        });
        
        Object.defineProperty(this, "vm", {

hyperactiv

Super small observable & reactive objects library.

MIT
Latest version published 2 years ago

Package Health Score

52 / 100
Full package analysis