Inspector

Inspector is a real-time attribute inspector widget for YUI 3.

Hook Inspector up to any class that implements the Attribute interface, such as Base- and Widget-derived classes, and watch its attribute values change as the application runs.

Toggle Inspector's Pause checkbox to freeze attribute values (they still might change behind the scenes, just not in Inspector).

Use Inspector's attribute filter to narrow the attribute list.

Collapse Inspector to get it out of your way, or drag it by the header to a new location.

Screenshot

Usage

Add the yui3-skin-sam class to your body, then:

YUI().use('base', 'gallery-inspector', function (Y) {
    
    // 1. Define an object with attributes. Base is a good place to start.
    var Test = Y.Base.create('test', Y.Base, [], {}, {
        ATTRS: {
            foo: {
                value: 'bar'
            },
            
            baz: {
                value: true
            }
        }
    }),
    
    // 2. Instantiate the object
    test = new Test(),
    
    // 3. Hook it up to an Inspector
    inspector = new Y.Inspector({
        host: test
    }).render();
    
    // 4. Then watch it in real-time as attributes change
    Y.later(2500, test, function () {
        this.setAttrs({
            foo: 'not bar',
            baz: false
        });
    });
    
});

Or, using the plugin:

YUI().use('gallery-inspector-plugin', function (Y) {
    // Instantiate a Base- or Widget-based object ...
    
    obj.plug(Y.Plugin.Inspector);
});

Configuration

These are the most interesting. Have a look at the source for more.

Supported Browsers

Other browsers may work, but haven't been tested.

Known Issues

Links

License

Copyright (c) 2011 Brett Stimmerman (brettstimmerman@gmail.com). All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.