gridstack_off
Remove event listeners from GridStack.js dashboard elements to manage widget interactions and optimize performance by eliminating unnecessary callbacks.
Instructions
Remove event listener
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventName | Yes | Event name to remove listener for |
Implementation Reference
- src/tools/index.ts:1111-1118 (handler)The core handler function for the 'gridstack_off' tool. It extracts the eventName from input parameters and generates JavaScript code to remove the GridStack event listener using grid.off(eventName). Delegates formatting to GridStackUtils.private async removeEventListener(params: any): Promise<string> { const { eventName } = params; return this.utils.generateGridStackCode("removeEventListener", { eventName, code: `grid.off('${eventName}');`, }); }
- src/tools/index.ts:628-655 (schema)Input schema definition for the 'gridstack_off' tool, specifying the required 'eventName' parameter with valid GridStack event enums.{ name: "gridstack_off", description: "Remove event listener", inputSchema: { type: "object", required: ["eventName"], properties: { eventName: { type: "string", enum: [ "added", "change", "disable", "drag", "dragstart", "dragstop", "dropped", "enable", "removed", "resize", "resizestart", "resizestop", ], description: "Event name to remove listener for", }, }, }, },
- src/tools/index.ts:837-838 (registration)Registration in the tool dispatcher switch statement within callTool method, mapping 'gridstack_off' calls to the removeEventListener handler.case "gridstack_off": return this.removeEventListener(args);
- src/utils/gridstack-utils.ts:16-27 (helper)Helper utility method used by the handler to format and generate the standardized response including code, description, parameters, example, and notes for the grid.off operation.generateGridStackCode(operation: string, params: any): string { const result: GridStackCodeResult = { operation, parameters: params, code: params.code || "", description: this.getOperationDescription(operation), example: this.getOperationExample(operation), notes: this.getOperationNotes(operation), }; return this.formatResponse(result); }
- src/tools/index.ts:762-762 (registration)The 'gridstack_off' tool is registered by being included in the array returned by listTools(), making it discoverable by MCP clients.];