Categories

jQuery.isClass()

Categories: Utilities

jQuery.isClass( obj, [ strict ] )Returns: Booelean

Plugin: jQuery.class

Description: Determine whether the argument is an class object.

  • jQuery.isClass( obj, [ strict ] )

    version added: 1.0

    obj   Object to test whether or not it is a function.

    strict   A boolean indication whether the class was created with jQuery.Class().

This method determines whether the argument is an class object.

  • Check if the givn obj is a class.

    Code:
    // define a class object
    $.Class( 'bar.Controller', {
        Contructor: function( data ){
            this.data = data || {};
        },
        getDat: function(){
            return this.data;
        }
    });
    
    foo.Controller = function( data ){
        this.data = data || {};
    }
    
    foo.prototype.getData = function(){
        return this.data;
    }
    
    $.isClass( bar );
    // results: true
    
    $.isClass( foo );
    // results: true
    
    $.isClass( bar, true );
    // results: true
    
    $.isClass( foo, true );
    // results: false