Lively Kernel canvas // this script is evaluated on world load MyConsole = WorldMorph.current().submorphs.detect(function(ea){return ea.name == "MyConsole"}); if(!MyConsole) return; MyConsole = MyConsole.component; MyConsole.setText("-- start --"); MyConsole.log = function(s) { this.setText(this.formalModel.getText() + "\n" + s); }; MyConsole.log("My Console initialized!"); MyConsole.morph.resetScrollPane = function() { var sp = this.enclosingScrollPane(); if (sp) sp.scrollToBottom(); }; // console.consumers seems to be broken... so we go the hard waz console.log = console.log.wrap(function(proceed, s) { MyConsole.log(s) proceed(s)}) console.log("wrapped console for MyConsole successfully") FixBoundEvalrequire('cop.CopBenchmark').toRun(function(){Object.subclass('MyClass',{foo1:function(a){returna*a},foo2:function(a){returna*a},})createLayer("MyLayer");layerClass(MyLayer,MyClass,{foo2:function(proceed,a){returnproeed(a)*a}})enableLayer(MyLayer)CopBenchmark.result=""benchmakeBlock(benchmakeBlock("nothing",1,function(size,obj){for(vari=0;i<size;i++){}}))})a=function(){})-----loadingscripthttps://lively-kernel.org/repository/webwerkstatt2011/lively/LKWiki.jshttps://lively-kernel.org/repository/webwerkstatt2011/anonymous_module_4loadedin2480mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/lib.jsloadedin694mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/ometa-base.jsloadedin1158mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/parser.jsloadedin1135mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/LKFileParser.jsloadedin2413mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/bs-ometa-optimizer.jsloadedin706mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/bs-js-compiler.jsloadedin913mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/bs-ometa-compiler.jsloadedin932mshttps://lively-kernel.org/repository/webwerkstatt2011/ometa/lk-parser-extensions.jsloadedin1402mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/Ometa.jsloadedin2654mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/ide/FileParsing.jsloadedin3112mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/ide/SourceDatabase.jsloadedin3793mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/ide/SystemCodeBrowser.jsloadedin3950mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/ide.jsloadedin3958mshttps://lively-kernel.org/repository/webwerkstatt2011/lively/LKWiki.jsloadedin396msstartingWikiNavigatorhttps://lively-kernel.org/repository/webwerkstatt2011/anonymous_module_5loadedin529ms050ConsolecreateLayer('BugFixLayer')layerClass(BugFixLayer,TextMorph,{tryBoundEval:function(proceed,str,offset,printIt){console.log("debugeval")varresult;try{result=this.boundEval(str);if(printIt){this.setNullSelectionAt(this.selectionRange[1]+1);varprevSelection=this.selectionRange[0];varreplacement=""+resultthis.replaceSelectionWith(replacement);this.setSelectionRange(prevSelection,prevSelection+replacement.length);}}catch(e){offset=offset||0;varmsg=""+e+"\n"+"Line:"+e.line+"\n"+(e.sourceURL?("URL:"+(newURL(e.sourceURL).filename())+"\n"):"");if(e.stack){//makethestackfitintostatuswindowvarprefix=(newURL(Config.codeBase)).withRelativePartsResolved().toString()msg+=e.stack.replace(newRegExp(prefix,"g"),"");}this.world().setStatusMessage(msg,Color.red,5,function(){require('lively.Helper').toRun(function(){alert('Therwasanerrror\n'+printObject(e))})},{fontSize:12,fillOpacity:1})if(e.expressionEndOffset){//console.log("e.expressionBeginOffset"+e.expressionBeginOffset+"offset="+offset)this.setSelectionRange(e.expressionBeginOffset+offset,e.expressionEndOffset+offset);}elseif(e.line){varlineOffset=this.lineNumberForIndex(offset);//console.log("line:"+e.line+"offset:"+lineOffset)varline=this.lines[e.line+lineOffset-1]if(line&&line.startIndex){//console.log("setto"+line.startIndex)this.setSelectionRange(line.startIndex,line.getStopIndex());}}this.setStatusMessage(""+e,Color.red);}returnresult;},})WorldMorph.addMethods({setStatusMessage:function(msg,color,delay,callback,optStyle){console.log("statusmsg:"+msg)varstatusMorph=this._statusMorph||newTextMorph(pt(400,30).extentAsRectangle());statusMorph.applyStyle({borderWidth:0,fill:Color.gray,fontSize:16,fillOpacity:0.5});if(optStyle)statusMorph.applyStyle(optStyle);statusMorph.textString=msg;statusMorph.setTextColor(color||Color.black);if(callback){statusMorph.enableEvents();statusMorph.handlesMouseDown=Functions.True;varpressed=false;statusMorph.onMouseDown=function(){if(!pressed)callback();pressed=true;returntrue};statusMorph.onMouseMove=Functions.NULL;}else{statusMorph.ignoreEvents();}this.addMorph(statusMorph);statusMorph.align(statusMorph.bounds().topRight(),this.windowBounds().topRight());(functionremoveStatusMorph(){statusMorph.remove()}).delay(delay||4);},})Wikicontrol