title $coremoduleswidgetsaction-logjstype applicationjavascriptmodule-type widgetAction widget to log debug messagesfunctionjslint node true browser true global $tw false use strict;var Widget = requi
在调用 <$action-log> 组件时,$$filter 参数是通过 $action-log 组件的 execute 方法中的 this.getAttribute("$$filter") 语句来获取的。getAttribute 方法用于获取组件的属性,$$filter 是其中一个属性。在这个例子中,$$filter 属性的值是 "[prefix[tv-]]"。
在 execute 方法中,$$filter 属性的值被存储在 this.filter 变量中。然后,在 log 方法中,this.filter 变量被用来编译过滤器,并通过调用 .call(this.wiki, this.wiki.makeTiddlerIterator(allVars)) 方法来获取过滤后的变量。过滤器使用了 this.wiki 对象的 compileFilter 方法来编译过滤器字符串,并使用 call 方法将过滤器应用于 this.wiki.makeTiddlerIterator(allVars) 迭代器。最后,过滤后的变量存储在 filteredVars 变量中,并在日志中使用。
总结起来,$$filter 参数通过 execute 方法中的 this.getAttribute("$$filter") 语句获取,并在 log 方法中使用编译后的过滤器来过滤变量
原文地址: https://www.cveoy.top/t/topic/iSod 著作权归作者所有。请勿转载和采集!