// const UNCHECKED = 0;
// const CHECKED = 1;
// const INDETERMINATE = 2;
// class TableController {
// constructor() {
// this.listSize = 0;
// this.seenList = new Map();
// this.selectedCount = 0;
// this.previousState = UNCHECKED;
// }
// // When called, should return true when the site
// // with the specified site is checked. "site" is
// // a string.
// getIsSiteCheckboxSelected(site) {
// return this.seenList.get(site) === CHECKED;
// }
// // When called, should return either CHECKED, UNCHECKED,
// // or INDETERMINATE indicating the current state of the
// // 'select all' checkbox.
// getSelectAllCheckboxState() {
// if (this.selectedCount > 0 && this.selectedCount === this.listSize) {
// return CHECKED;
// } else if (this.selectedCount > 0 && this.listSize > 1) {
// return INDETERMINATE;
// }
// return UNCHECKED;
// }
// ////////////////////////////////////////
// // Information received by this class
// ////////////////////////////////////////
// // Will be called by the UI whenever the "select all" checkbox
// // is clicked.
// handleSelectAllCheckboxClicked() {
// const previousState = this.previousState;
// if (previousState === UNCHECKED) {
// this.selectedCount = 0;
// this.seenList.forEach((site, value) => {
// this.seenList.set(
// site,
// previousState === UNCHECKED ? CHECKED : UNCHECKED,
// );
// });
// }
// }
// // Will be called by the UI whenever any of the checkboxes
// // next to a single site are clicked. site is a string.
// handleSingleSiteCheckboxClicked(site) {
// if (this.seenList.has(site)) {
// const currentState = this.seenList.get(site);
// const newState = currentState === CHECKED ? UNCHECKED : CHECKED;
// this.previousState = newState;
// this.seenList.set(site, newState);
// ...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.