Warning: Developer Pages

This page is part of a set of pages aimed at DWR developers. If this isn't you, then you probably want the documentation index.

Engine.js Development Notes

The following notes are aimed at developers. Please do not try to understand how to use engine.js from these notes.

DWREngine._getObjectClassName

These notes supplied by Mike Wilson

As can be seen in the below matrix all tested platforms return the correct classname for all three object categories, except IE6 client-side objects that always return "Object".

PLATFORM BEHAVIOUR:       IE6       FF1.5     Safari2.0
user-defined classes:     class     class     class
JavaScript core classes:  class*    class*    class
client-side/DOM classes:  Object    class     class
(* = all classes correct except Arguments->Object)

PERFORMANCE               IE6       FF1.5     Safari2.0
obj = new Superclass      8 usec    11 usec   3 usec
obj = new Subclass        15 usec   18 usec   8 usec
getObjectClassName(obj)   28 usec   75 usec   41 usec

This is a comparison that shows that querying object classnames has a performance of about the same order of magnitude as creating the objects. In the example the Subclass constructor calls the constructor of Superclass therefore the longer execution time for creating Subclass instances. Note that the IE6 and Safari2.0 numbers ARE comparable as FF1.5 has been used on both Windows and Mac platforms to balance the scores.

Return values from constructor.toString()

(* denotes deviations)
user-defined classes:    IE6:              function <class>
                         FF1.5:            function <class>
                         Safari2.0:        function <class>
native classes:          IE6:              function <class>
                         * Arguments:        function Object
                         * Error subclasses: [object Error]
                         FF1.5:            function <class>
                         * Arguments:        function Object
                         Safari2.0:        (Internal Function)
client-side/DOM classes: IE6:              N/A (no constructor)
                         FF1.5:            [<class>]
                         Safari2.0:        (Internal Function)

Return values from Object.toString()

user-defined classes:    IE6:              [object Object]
                         FF1.5:            [object Object]
                         Safari2.0:        [object Object]
native classes:          IE6:              [object <class>]
                         FF1.5:            [object <class>]
                         * Arguments:        [object Object]
                         * Error subclasses: [object Error]
                         Safari2.0:        [object <class>]
                         * Error+subclasses  [object Object]
client-side/DOM classes: IE6:              [object Object]
                         FF1.5:            [object <class>]
                         Safari2.0:        [object <class>]