def create_js_hasevents_class(cls, cls_name, base_class='HasEvents.prototype'):
    
    assert cls_name != 'HasEvents'  # we need this special class above instead
    
    handlers = []
    emitters = []
    properties = []
    total_code = []
    funcs_code = []  # functions and emitters go below class constants
    const_code = []
    err = ('Objects on JS HasEvents classes can only be int, float, str, '
           'or a list/tuple thereof. Not %s -> %r.')
    
    total_code.extend(get_class_definition(cls_name, base_class))
    prefix = '' if cls_name.count('.') else 'var '
    total_code[0] = prefix + total_code[0]
    
    for name, val in sorted(cls.__dict__.items()):
        name = name.replace('_JS__', '_%s__' % cls_name.split('.')[-1])  # fix mangling
        funcname = '_' + name + '_func'
        if isinstance(val, BaseEmitter):
            if isinstance(val, Property):
                properties.append(name)
            else:
                emitters.append(name)
            # Add function def
            code = py2js(val._func, cls_name + '.prototype.' + funcname)
            code = code.replace('super()', base_class)  # fix super
            funcs_code.append(code.rstrip())
            # Mark to not bind the func
            t = '%s.prototype.%s.nobind = true;'
            funcs_code.append(t % (cls_name, funcname))
            # Add type of emitter
            t = '%s.prototype.%s._emitter_type = %s;'
            emitter_type = val.__class__.__name__
            funcs_code.append(t % (cls_name, funcname, reprs(emitter_type)))
            funcs_code.append('')
        elif isinstance(val, HandlerDescriptor):
            handlers.append(name)
            # Add function def
            code = py2js(val._func, cls_name + '.prototype.' + funcname)
            code = code.replace('super()', base_class)  # fix super
            funcs_code.append(code.rstrip())
            # Mark to not bind the func
            t = '%s.prototype.%s.nobind = true;'
            funcs_code.append(t % (cls_name, funcname))
            # Add connection strings to the function object
            t = '%s.prototype.%s._connection_strings = %s;'
            funcs_code.append(t % (cls_name, funcname, reprs(val._connection_strings)))
            funcs_code.append('')
        elif callable(val):
            code = py2js(val, cls_name + '.prototype.' + name)
            code = code.replace('super()', base_class)  # fix super
            funcs_code.append(code.rstrip())
            funcs_code.append('')
        elif name.startswith('__'):
            pass  # we create our own __emitters__ list
        else:
            try:
                serialized = json.dumps(val)
            except Exception as err:  # pragma: no cover
                raise ValueError('Attributes on JS HasEvents class must be '
                                 'JSON compatible.\n%s' % str(err))
            const_code.append('%s.prototype.%s = JSON.parse(%s)' %
                              (cls_name, name, reprs(serialized)))
    
    # Store handlers, properties and emitters that we found
    if base_class in ('Object', 'HasEvents.prototype'):
        t = '%s.prototype.__emitters__ = %s;'
        total_code.append(t % (cls_name, reprs(list(sorted(emitters)))))
        t = '%s.prototype.__properties__ = %s;'
        total_code.append(t % (cls_name, reprs(list(sorted(properties)))))
        t = '%s.prototype.__handlers__ = %s;'
        total_code.append(t % (cls_name, reprs(list(sorted(handlers)))))
    else:
        t = '%s.prototype.__emitters__ = %s.__emitters__.concat(%s).sort();'
        total_code.append(t % (cls_name, base_class, reprs(emitters)))
        t = '%s.prototype.__properties__ = %s.__properties__.concat(%s).sort();'
        total_code.append(t % (cls_name, base_class, reprs(properties)))
        t = '%s.prototype.__handlers__ = %s.__handlers__.concat(%s).sort();'
        total_code.append(t % (cls_name, base_class, reprs(handlers)))
    
    total_code.append('')
    total_code.extend(const_code)
    total_code.append('')
    total_code.extend(funcs_code)
    return '\n'.join(total_code)
return a list of my index cols
dataset/ETHPy150Open zoofIO/flexx/flexx/event/_js.py/create_js_hasevents_class--crossover with--dataset/ETHPy150Open pydata/pandas/pandas/io/pytables.py/Table.index_cols