
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
boardmaker-lib
Advanced tools
BoardMakerThe BoardMaker function creates and returns an instance of a dynamic grid board within a specified HTMLDivElement context. This board supports various operations like initializing the grid, manipulating elements, and handling custom events.
BoardMaker(context: HTMLDivElement, options: Options): BoardMakerCreates a new board within a given HTMLDivElement context using the specified options.
context (HTMLDivElement): The container element where the grid will be initialized.options (Options): Configuration options for the board, which include:
width (number): The number of columns in the grid.height (number): The number of rows in the grid.BoardMaker: An instance of the BoardMaker class with several methods and properties for managing the grid.width (number): The width (number of columns) of the grid.height (number): The height (number of rows) of the grid.context (HTMLDivElement): The HTML container for the grid.elements (object): Methods to manipulate the grid elements.borders (object): Methods to manipulate the grid borders.init(): thisInitializes and populates the grid within the specified context. Clears any existing content and creates a grid based on the provided width and height.
this: The current instance of BoardMaker for chaining purposes.board.init();
on(eventName: string, listener: (...args: any[]) => void): voidAdds an event listener for a specific event name.
Parameters
board.on("init", (context) => {
console.log("Board initialized!", context);
});
getPositions(): Position[]Converts the current grid context into metadata, returning an array of positions for each element in the grid.
Position[]: An array of positions representing each element in the grid with x and y.const positions = board.getPositions();
console.log(positions);
getElement(position: Position): HTMLDivElement | nullGets an element from the grid at a specified position. Should only be called after the grid has been initialized with .init().
Parameters
position (Position): The position of the desired element in the grid.HTMLDivElement | null: The HTML element at the specified position, or null if not found.const element = board.getElement({ x: 1, y: 2 });
console.log(element);
getElements(): HTMLDivElement[]Retrieves all elements in the grid as an array of HTMLDivElement.
HTMLDivElement[]: An array of all elements in the grid.const elements = board.getElements();
console.log(elements);
elements().size(num: number): voidSets the border size for all elements in the grid.
Parameters
num (number): The size of the borders.
####Exampleboard.elements().size(2);
getPosition(item: HTMLDivElement): PositionGets the position of a specific item in the grid.
Parameters
item (HTMLDivElement): The item whose position is to be determined.Position: The position of the item within the grid with x and y.const position = board.getPosition(someItem);
console.log(position);
element(position: Position): objectGets the element at the specified position and provides methods to manipulate it.
Parameters
object: An object with methods to manipulate the element:borderColor(color: string): Sets the border color of the box.color(color: string): Sets the background color of the box.item (HTMLDivElement): The HTML element at the specified position.
const elem = board.element({ x: 1, y: 2 });
elem.borderColor('red');
elem.color('blue');
borders.hide(): voidHides all borders of the grid elements.
board.borders().hide();
borders().show(): voidShows all borders of the grid elements.
board.borders().show();
borders().colorize(color: string): voidSets the border color for all elements in the grid.
Parameters
color (string): The color to set for the borders.
board.borders().colorize('red');
const container = document.getElementById('grid-container');
const options = { width: 5, height: 5 };
const board = new BoardMaker(container, options);
board.init();
board.on('init', (context) => console.log('Grid initialized!', context));
board.emit('init', container);
const elements = board.getElements();
console.log(elements);
FAQs
Create HTML checkerboard-like Board Games
We found that boardmaker-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.