[Laszlo-dev] where should runtime-specific chunks of LFC code go?
Max Carlson
max at laszlosystems.com
Thu Apr 6 17:07:16 EDT 2006
Not if you think of a series of kernel services that provide the same
features across runtimes. Classes call into the kernel(s).
-Max
P T Withington wrote:
> But that will be tough to do if we start writing classes. I.e., it's
> hard to put just bits of a class in a separate file.
>
> Oh wait. Traits! :P
>
> On 2006-04-06 13:57 PDT, Max Carlson wrote:
>
>> I was thinking kernel/as/*.as and kernel/js/*.js in a top-level
>> directory. That way, all the runtime-specific stuff is grouped together.
>>
>> -Max
>>
>> Henry Minsky wrote:
>>> OK, I have two versions of a function, one for DHTML and one for SWF.
>>> In the source code file I currently have
>>> this conditionalized as follows in data/LzDataNode.lzs.
>>> But if I want to be cleaner about separting out runtime-independent
>>> code, how should I do this?
>>> Shoud create two new separate files just to hold these two versions
>>> of the function ? I.e., in the new kernel/ directory make files for
>>> the two copies of this function, LzDataText.as and lzDataText.js?
>>> Or should I make a kernel/ subdirectory under the lfc/data directory?
>>> That is, each subdir should have a kernel dir for runtime-specific
>>> stuff?
>>> if ($dhtml) {
>>> LzDataNode.stringToLzData = function( str, trimwhitespace ) {
>>> var doc;
>>> if (typeof(DOMParser) != "undefined") {
>>> // Mozilla :-)
>>> var parser = new DOMParser();
>>> doc = parser.parseFromString(str, "text/xml");
>>> } else {
>>> // IE :-(#
>>> doc = new ActiveXObject("Microsoft.XMLDOM");
>>> doc.async="false";
>>> doc.loadXML(str);
>>> }
>>> if ( doc.childNodes.length != 1 ) return null;
>>> var lfcnode = LzDataset.prototype.copyBrowserXML(doc, true, 0);
>>> var fc = lfcnode.removeChild( lfcnode.getFirstChild()
>>> ); if ( fc instanceof LzDataText ) return null;
>>> return fc;
>>> }
>>> } else {
>>> LzDataNode.stringToLzData = function( str, trimwhitespace ) {
>>> var xmlobj = new XML();
>>> xmlobj.ignoreWhite = true;
>>> xmlobj.parseXML( str );
>>> if ( xmlobj.childNodes.length != 1 ) return null;
>>> var lfcnode = LzLoader.prototype.copyFlashXML(xmlobj,
>>> trimwhitespace);
>>> var fc = lfcnode.removeChild( lfcnode.getFirstChild()
>>> ); if ( fc instanceof LzDataText ) return null;
>>> return fc;
>>> }
>>> }
>>> --Henry Minsky
>>> Software Architect
>>> hminsky at laszlosystems.com <mailto:hminsky at laszlosystems.com>
>>
>>
>>
>> --Regards,
>> Max Carlson
>> OpenLaszlo.org
>
>
--
Regards,
Max Carlson
OpenLaszlo.org
More information about the Laszlo-dev
mailing list