gridstack_off
Remove event listeners from GridStack.js dashboard widgets to manage event handling and optimize performance.
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 destructures the eventName from the input parameters and uses GridStackUtils to generate executable JavaScript code that calls grid.off(eventName) to remove the specified event listener from the GridStack grid instance.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)The input schema and tool registration for gridstack_off, defining the name, description, and required eventName parameter with an enum of valid GridStack event names.{ 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)The dispatch case in the central callTool switch statement that routes gridstack_off calls to the removeEventListener handler.case "gridstack_off": return this.removeEventListener(args);
- src/resources/index.ts:184-184 (helper)Documentation reference to the gridstack_off tool in the API documentation markdown.- \`gridstack_off\` - Remove event listener