JSFiddle - React, Tailwind, and code Playground

List all Methods of a JS Class

by Ben Clayton

HTML

<div id="node"></div>

JavaScript

//========================================================================================
		"use strict";
	
		class idisplayNode {
			constructor( el ) {

			   //debug	console.log("stateAnimate constructor");

				this.el = el;             // selector for groupwrapper element
				this.$el = $(el);		 // jquery object which represents groupwrapper

				// defaults
				this.timeout = 3;     // carousel change delay in seconds, set to 0 to make it inactive (as used when playing a video)
				this.showTotal = 0;
				this.showStartTime = 0;
				this.fadetime = 400;
				this.childsequencers = {};
				this.noderef = '';
				this.children = [];
				this.relayEvents = {};
				this.hasChildren = false;
				this.parentnoderef = '';
				this.requestEvents = [];
				this.requestEventsTimer = [];
				this.suspend = false;
				// error object
				this.error = {
					code : 0,
					msg : "",
					isOk : true
				};

			}
	
			func_scene() {
				return "scene-" + this.scene 
			}
	
			func_targetscreen() {
				return this.targetscreen 
			}

			func_isLeaf() {
				return this.isLeaf?"leaf":""; 
			}


			init( noderef, conf ) {
			   //debug	console.log("init this element el ",this.noderef, " is type " , this.constructor.name);
				// put config onto object as properties
				for ( var p in conf ){
					this[p] = conf[p]; // !! ADD check here to stop override is type don't match but allow undefinde.
				} 
				this.settimeout( this.timeout );
		
				this.noderef = noderef;
				
				this.parentnoderef = this.noderef.replace(/-\d+$/,''); // n-0-1-2 becomes n-0-1
				
				console.log( this.constructor.name, this.noderef, " init timeout=", this.timeout);

				// put data attribute reference to this object on element
				this.$el.data( "idisplay-object", this ); 

				// add classes to element
				this.$el.addClass( this.noderef ); // add class like 'n-0-1'
				
				// add classes to node element, derived from a list of object properties
				['scene','targetscreen','isLeaf'].forEach(...