[Webkit-unassigned] [Bug 38676] Web Inspector: make Web Inspector source code more "modular"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 6 13:24:36 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38676





--- Comment #3 from Patrick Mueller <pmuellr at yahoo.com>  2010-05-06 13:24:35 PST ---
One thought I've had is to create a set of functions to make it easier to build
our classes.

Here's the typical pattern, from ConsolePanel:

    WebInspector.ConsolePanel = function()
    {
        WebInspector.Panel.call(this);
    }

    WebInspector.ConsolePanel.prototype = {
    ...
    }

    WebInspector.ConsolePanel.prototype.__proto__ =
WebInspector.Panel.prototype;

I suspect we could create some functions to help with this.  They would be
useful should something happen like we find we can't use the non-standard
__proto__ property in the future.

    defClass(function ConsolePanel() {
        $super(this);
    })

    setSuperclass(Panel)

    defMethod(function someInstanceMethod() {

    })

    defStaticMethod(function someStaticMethod() {

    })

I've built such things in the past, with a bunch of different shapes.  I find
these read better than all the boilerplate that folks typically use.  I also
happen to dislike throwing all the prototype functions inside a literal object,
so that you have to deal with commas between elements, etc.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list