Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="page-wrap">
	<h1>Every Method in JavaScript</h1>
	<h2 class="subtitle">All Built-In Methods in JavaScript</h2>

	<p>Ever wonder exactly which methods are available on every JavaScript object? I did, plus I wanted to write a post listing all of them with links to more detail for each. So, I needed a tool. This is that tool.

	</p>
	<p>This tool grabs the available JavaScript objects and lists each with every method available on that object. It will also link each to MDN's write-up on it (if available).</p>

	<p>There are lists on MDN and other places of objects and methods, but I could not find anywhere with every object and every method all on one page, so this tool was my answer to obtain that.</p>

	<p>It will take about 4 - 7 minutes to complete its work. The links will be shown in black, except for the inherited methods, these will be shown in gray.</p>

	<button id='start-button'>Start</button>

	<div id="loading-wrap">
		<div id="loader" class="hidden">
			<p>We are now pulling each object and method from the browser and building the complete list. This will take between four to seven minutes. Stand by and watch the progress.</p>
			<div id="count-wrap"><p>We have completed <span id="count-box"></span>% of the work.</p>
				<p id="timeholder" class="hidden">Total time taken: <span id="time"></span> minutes.</p>
			</div>
		</div>
	</div>

	<p><a href="https://www.glassinteractive.com/every-method-in-javascript/" target="_blank" >If you do not want to wait, the full list saved here &rarr;</a></p>

	<div id="method-list-wrap">
		<div class="loader-wrap">
			<div class="loader loader8">
				<div class="loader8inner"></div>
				<div class="loader8inner"></div>
				<div class="loader8inner"></div>
			</div>
		</div>
	</div>
</div>
              
            
!

CSS

              
                body {margin: 0;}

#page-wrap{
	background-color: black;
	color: white;
	padding: 1em 2em;
	width: 100%;
	min-height: 100vh;
}

p {
	max-width: 500px;
}

#method-list-wrap {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

#method-list-wrap .method-list {
	display: block;
	flex-direction: column;
	position: relative;
	/* max-height: 25em; */
	overflow: hidden;
	padding: 0 2em 2em;
	margin: 1em;
	box-shadow: -1em -1em 1em -1em #bdbdbd inset;
	transition: 2s all ease;
	/* transition-delay: 0.5s; */
	border-radius: 0.25em;
	/* height: 25em; */
	transition-timing-function: cubic-bezier(0.24, 0.76, 1, 0.3);
	list-style: none;
	background: white;
  color: black;
}

.method-specific {
	background: #06649e;
	color: white;
	font-weight: 700;
	padding: 0.25em 0.5em 0.25em 0.25em;
	border-radius: 0.25em;
	line-height: 2em;
}

.inherited-method {
	opacity: 0.5;
	/* font-weight: 700; */
	color: inherit;
	transition: 0.3s all ease;
}

.inherited-method:hover {
	opacity: 1;
}

.inherited-method:hover:after {
	content: "Inherited Method";
	position: absolute;
	font-size: 0.7em;
	margin-left: 1em;
}

.hidden {
	display: none;
}

#loading-wrap {
	position: relative;
	width: 28em;
	background: black;
	color: white;
}

#loader {
	background: black;
	color: white;
	padding: 2em;
}

#loader:after {
	position: relative;
	content: '';
	display: block;
	background: #131417;
	color: white;
	width: 50px;
	height: 50px;
	animation: movement 7s linear infinite;
	box-shadow: inset -7px -7px 10px -7px rgb(0 0 0 / 0.5), inset 7px 7px 10px -7px white;
}

@keyframes movement {
	0% {
		background-color: black;
		border-radius: 50%;
		transform: translate(-70%)  scale(0.1, 1);
		left: 0;
	}

	25% {
		background-color: orangered;
		border-radius: 50%;
		transform: translate(-70%)  scale(1.5);
		left: 50%
	}

	50% {
		background-color: darkcyan;
		border-radius: 50%;
		transform: translate(-70%) scale(0.1,1);
		left: 100%
	}

	75% {
		background-color: yellowgreen;
		border-radius: 50%;
		transform: translate(-70%)  scale(0.5);
		left: 50%
	}

	100% {
		background-color: blueviolet;
		border-radius: 50%;
		transform: translate(-70%)  scale(0.1, 1);
		left: 0;
	}
}
              
            
!

JS

              
                let startTime;
function beginSearch() {

	toggleLoader()
	startTime = timer()
	setTimeout(function() {
		runTheSearch()
	}, 1000);
	
}

function finish(startTime) {
	console.log('*** FINISHED! ***')
	timer(startTime)
}
function toggleLoader() {
	const loader = document.getElementById('loader');
	loader.classList.toggle('hidden');
	console.log('Loader toggled')
}


function millisToMinutesAndSeconds(millis) {
  var minutes = Math.floor(millis / 60000);
  var seconds = ((millis % 60000) / 1000).toFixed(0);
  return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
}

function timer(startTime) {
	if(startTime) {
		console.log('startTime',startTime)
		let stopTime = performance.now();
		const timeTaken = millisToMinutesAndSeconds((stopTime - startTime).toFixed(0));
		let timeHolder = document.getElementById("timeholder");
		let time = document.getElementById("time");
		timeHolder.classList.toggle('hidden')
		time.innerText = timeTaken;
	} else {
			console.log('Timer started')
		return performance.now();
	}
}

const getMethods = (obj) => {
	let properties = new Set();
	let currentObj = obj;
	do {
		Object.getOwnPropertyNames(currentObj).map((item) =>
																							 properties.add(item)
																							);
	} while ((currentObj = Object.getPrototypeOf(currentObj)));
	return [...properties.keys()].filter((item) => {
		if (
			item != "arguments" &&
			item != "caller" &&
			item != "callee" &&
			item != "__proto__" &&
			item != "__defineGetter__" &&
			item != "__defineSetter__" &&
			item != "__lookupGetter__" &&
			item != "__lookupSetter__" &&
			typeof obj[item] === "function"
		) {
			return true;
		}
	}); //
};

const makeMethodList = function (theType, typeName) {
	typeName = typeName || theType.name;
	let allMethods = [];
	// const typeLowerCase = theType.toLowerCase();
	try {
		allMethods = getMethods(theType.prototype);
	} catch (error) {
		// console.log(error);
		// if (error) allMethods.push('*');
	}
	try {
		allMethods.push(...getMethods(theType));
	} catch (error) {}
	try {
		allMethods.push(...getMethods(new theType()));
	} catch (error) {}

	allMethods.sort();
	allMethods = new Set(allMethods);

	const listArray = [];
	allMethods.forEach((method) => {
		const listItem = document.createElement("li");
		listItem.setAttribute("id", method + "-link");
		listItem.className = "general-method-listitem";
		const theLink = document.createElement("a");
		theLink.setAttribute("target", "_blank");
		theLink.className = "general-method-link";

		var url =
				"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/" +
				typeName +
				"/" +
				method;

		(async () => {
			let response = await new Promise((resolve) => {
				var xhr = new XMLHttpRequest();
				xhr.open("GET", url, false);
				xhr.onload = function (e) {
					resolve(xhr.response);
				};
				xhr.onerror = function () {
					resolve(undefined);
					console.error("** An error occurred during the XMLHttpRequest");
				};
				try {
					xhr.send();
				} catch (error) {}
				console.log(xhr.status);
				if (xhr.status != 200) {
					theLink.setAttribute(
						"href",
						"https://developer.mozilla.org/en-US/search?q=" + method
					);
					theLink.classList.add("inherited-method");
				} else {
					theLink.setAttribute(
						"href",
						"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/" +
						typeName +
						"/" +
						method
					);
					theLink.classList.add("method-specific");
				}

				theLink.appendChild(document.createTextNode(method));

				listItem.appendChild(theLink);

				listArray.push(listItem);
			});
		})();

		// theLink.setAttribute(
		//   "href",
		//   "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/" +
		//     typeName +
		//     "/" +
		//     method
		// );

		// theLink.appendChild(document.createTextNode(method));

		// listItem.appendChild(theLink);

		// listArray.push(listItem);
	});

	const theUL = document.getElementById("method-list-wrap");
	const ulWrap = document.createElement("ul");
	ulWrap.setAttribute("id", typeName + "-ul");
	ulWrap.setAttribute("target", "_blank");
	ulWrap.className = "method-list grid-item";
	const ulTitle = document.createElement("h3");
	ulTitle.appendChild(document.createTextNode(typeName + " Methods"));
	ulWrap.appendChild(ulTitle);
	listArray.forEach((link) => {
		// console.log(link)
		ulWrap.appendChild(link);
	});
	theUL.appendChild(ulWrap);
};

let cnt = 0;
function runTheSearch() {
	const jsObjectArray = [
		Function,
		Object,
		Array,
		Int8Array,
		Uint8Array,
		Uint8ClampedArray,
		Int16Array,
		Uint16Array,
		Int32Array,
		Uint32Array,
		Float32Array,
		Float64Array,
		BigInt64Array,
		BigUint64Array,
		String,
		RegExp,
		Symbol,
		Boolean,
		Number,
		BigInt,
		Math,
		Date,
		Map,
		Set,
		WeakMap,
		WeakSet,
		EventTarget,
		Error,
		EvalError,
		RangeError,
		ReferenceError,
		SyntaxError,
		TypeError,
		URIError,
		ArrayBuffer,
		[SharedArrayBuffer, "SharedArrayBuffer"],
		[Atomics, "Atomics"],
		DataView,
		[JSON, "JSON"],
		Promise,
		[Reflect, "Reflect"],
		Proxy,
		[Intl, "Intl"],
		Intl.Collator,
		Intl.DateTimeFormat,
		Intl.ListFormat,
		Intl.NumberFormat,
		Intl.PluralRules,
		Intl.RelativeTimeFormat,
		Intl.Locale,
		[WebAssembly, "WebAssembly"],
		WebAssembly.Module,
		WebAssembly.Instance,
		WebAssembly.Memory,
		WebAssembly.Table,
		WebAssembly.CompileError,
		WebAssembly.LinkError,
		WebAssembly.RuntimeError,
		/*globalThis,*/
	];
	let cnt = 0;
	jsObjectArray.forEach((obj) => {
		// This is moved out of the thread 
		// to preventblocking updating the DOM
		setTimeout(createEntry, 1000);
		function createEntry() {
			console.log("obj", obj);
			if (!obj[1]) {
				makeMethodList(obj);
			} else {
				makeMethodList(obj[0], obj[1]);
			}
			cnt++;
			const cntBox = document.getElementById('count-box');
			const cntPercentage = cnt/jsObjectArray.length * 100;
			cntBox.innerText = cntPercentage.toFixed(2);
			console.log('cntPercentage >= 1', cntPercentage >= 1)
			if(cntPercentage >= 100) finish(startTime);
		}
	});
}

const startBtn = document.getElementById('start-button');
startBtn.addEventListener('click', beginSearch)

              
            
!
999px

Console