Lively Kernel canvas
DynamicScope40true
Wikicontroltruetrue
//ClassDefinitionObject.subclass("MyObject",{foo:function(){return"Hello"},//DomainspecificLayercompositionactiveLayers:function(){returncomposeLayers(LayerActivationStack,LayerActivationStack.length-1)}});createLayer("WorldLayer");layerClass(WorldLayer,MyObject,{foo:function(proceed){returnproceed()+"World!"}})o=newMyObject();console.log("base:"+o.foo())//HellowithLayers([WorldLayer],function(){console.log("withWorldLayer:"+o.foo())})withLayers([WorldLayer],function(){withoutLayers([WorldLayer],function(){console.log("withWorldLayer>withoutWorldLayer:"+o.foo());})console.log("withWorldLayer:"+o.foo());})console.log("base:"+o.foo());//Byoverriding"activeLayers"objectscanencapsulate/protectthemselvesagainstunwantedadaptationMyObject.subclass("MySubObject",{activeLayers:function(){return[]}});o2=newMySubObject();console.log("base:"+o2.foo())//Hello//ThedynamiclayeractivationofWorldLayerdoesnotaffecto2withLayers([WorldLayer],function(){console.log("withWorldLayer:"+o2.foo())}) without WorldLayer: \" + o.foo());\n\t})\n\tconsole.log(\"with WorldLayer: \" + o.foo());\n})\nconsole.log(\"base: \" + o.foo());\n\n\n\n// By overriding \"activeLayers\" objects can encapsulate / protect themselves against unwanted adaptation\nMyObject.subclass(\"MySubObject\", {\n\tactiveLayers: function() {\n\t\treturn []\n\t} \n});\n\no2 = new MySubObject();\nconsole.log(\"base: \" + o2.foo()) // Hello\n\n// The dynamic layer activation of WorldLayer does not affect o2\nwithLayers([WorldLayer], function() {\n\tconsole.log(\"with WorldLayer: \" +o2.foo())\n})\n\n\n\n\n"]]>38truetruefalse without WorldLayer: \" + o.foo());\n\t})\n\tconsole.log(\"with WorldLayer: \" + o.foo());\n})\nconsole.log(\"base: \" + o.foo());\n\n\n\n// By overriding \"activeLayers\" objects can encapsulate / protect themselves against unwanted adaptation\nMyObject.subclass(\"MySubObject\", {\n\tactiveLayers: function() {\n\t\treturn []\n\t} \n});\n\no2 = new MySubObject();\nconsole.log(\"base: \" + o2.foo()) // Hello\n\n// The dynamic layer activation of WorldLayer does not affect o2\nwithLayers([WorldLayer], function() {\n\tconsole.log(\"with WorldLayer: \" +o2.foo())\n})\n\n\n\n\n"]]>truetrue
false00.11truefalsetruetrue
nullfalsetruenull
falsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
GlobalLayerActivations=[]LayerActivationStack=[]Object.addMethods({activeLayers:function(){returncomposeLayers(LayerActivationStack,LayerActivationStack.length-1)}})composeLayers=functioncomposeLayers(activationStack,index){//1.GlobalLayerActivationsif(index<0){returnGlobalLayerActivations}varactivation=activationStack[index]varlayerComposition=composeLayers(activationStack,index-1)//2.DynamicLayerActivationsif(activation.withLayers){layerComposition=layerComposition.reject(function(ea){returnactivation.withLayers.include(ea)})returnlayerComposition.concat(activation.withLayers)}//3.DynamicLayerDeactivationsif(activation.withoutLayers){layerComposition=layerComposition.reject(function(ea){returnactivation.withoutLayers.include(ea)})returnlayerComposition}}//META:dotheybelongbeforeofafterthecompositioncodewithLayers=functionwithLayers(layers,func){LayerActivationStack.push({withLayers:layers});try{func()}finally{LayerActivationStack.pop()}}withoutLayers=functionwithoutLayers(layers,func){LayerActivationStack.push({withoutLayers:layers})try{func()}finally{LayerActivationStack.pop()}}truetruefalse27truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
-----falsetruefalsetrue0
fontCourier12:spacewidth7from21xWidth7falsetruefalsetrue0
fontCourier12:spacewidth7from21xWidth7falsetruefalsetrue0
fontHelvetica40:spacewidth4076from4116xWidth20falsetruefalsetrue0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalsetrue0
fitWidthfailureonTextMorph.getCharBoundsfalsetruefalsetrue0
worldis1:WorldMorph([[undefined,undefined,2289.5,1866.5]])falsetruefalsetrue0
loadingscripthttp://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../cop/CopBenchmark.jsfalsetruefalsetrue0
startingWikiNavigatorfalsetruefalsetrue0
status207onPROPFINDhttp://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/DynamicScope.xhtmlfalsetruefalsetrue0
status207onPROPFINDhttp://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/DynamicScope.xhtmlfalsetruefalsetrue0
http://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../anonymous_module_4loadedin20msfalsetruefalsetrue0
http://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../anonymous_module_2loadedin527msfalsetruefalsetrue0
loadingscripthttp://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../lively/TestFramework.jsfalsetruefalsetrue0
loadedLayersTest.jsfalsetruefalsetrue0
loadedTestFramework.jsfalsetruefalsetrue0
http://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../lively/TestFramework.jsloadedin65msfalsetruefalsetrue0
http://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../cop/CopBenchmark.jsloadedin399msfalsetruefalsetrue0
http://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/../../anonymous_module_3loadedin402msfalsetruefalsetrue0
Moduleloadcheckdone.30modulesloaded.falsetruefalsetrue0
statusmsg:SyntaxError:ParseerrorLine:301falsetruefalsetrue0
status:SyntaxError:Parseerrorfalsetruefalsetrue0
fontHelvetica16:spacewidth1637from1653xWidth8falsetruefalsetrue0
statusmsg:SyntaxError:ParseerrorLine:301falsetruefalsetrue0
status:SyntaxError:Parseerrorfalsetruefalsetrue0
base:Hellofalsetruefalsetrue0
withWorldLayer:HelloWorld!falsetruefalsetrue0
withWorldLayer>withoutWorldLayer:Hello without WorldLayer: Hello"]]>falsetruefalsetrue0
withWorldLayer:HelloWorld!falsetruefalsetrue0
base:Hellofalsetruefalsetrue0
base:Hellofalsetruefalsetrue0
withWorldLayer:Hellofalsetruefalsetrue0
-------------------------------------------falsetruefalsetrue0
invoke1:WorldMorph([[undefined,undefined,2289.5,1866.5]])falsetruefalsetrue0
statusmsg:serializing....falsetruefalsetrue0
problemstoparsehttp://lively-kernel.org/repository/webwerkstatt/contextjs/implementation/DynamicScope.xhtmlfalsetruefalsetrue0
extendForSerialization[objectSVGDefsElement]falsetruefalsetrue0837.000015
- without WorldLayer: Hello"]]>
-1nullnulltrue0falsetruetrue
false00.11truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetrue
truetrue100truefalse
truefalse050null
nullfalsetruenull
Consolefalsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
null67