UNPKG

ractive

Version:

Next-generation DOM manipulation

26 lines (21 loc) 629 B
export default function Viewmodel$clearCache ( keypath, dontTeardownWrapper ) { var cacheMap, wrapper, computation; if ( !dontTeardownWrapper ) { // Is there a wrapped property at this keypath? if ( wrapper = this.wrapped[ keypath ] ) { // Did we unwrap it? if ( wrapper.teardown() !== false ) { this.wrapped[ keypath ] = null; } } } if ( computation = this.computations[ keypath ] ) { computation.compute(); // TODO this can't be right? } this.cache[ keypath ] = undefined; if ( cacheMap = this.cacheMap[ keypath ] ) { while ( cacheMap.length ) { this.clearCache( cacheMap.pop() ); } } }