From 8d34b70899a0e7c059477eacbab0b08fd5e289bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Wed, 16 Feb 2022 12:27:06 +0100 Subject: [PATCH] (core) Exposing WidgetApi methods in a module scope Summary: Exposing WidgetApi methods (getOption, setOption, ...) in a module scope to simplify custom widget code. Test Plan: manual tests for now, as plugin is not yet on production. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3268 --- app/plugin/grist-plugin-api.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/plugin/grist-plugin-api.ts b/app/plugin/grist-plugin-api.ts index f9fb2859..23548b3a 100644 --- a/app/plugin/grist-plugin-api.ts +++ b/app/plugin/grist-plugin-api.ts @@ -73,6 +73,13 @@ export const docApi: GristDocAPI & GristView = { export const on = rpc.on.bind(rpc); +// Exposing widgetApi methods in a module scope. +export const getOption = widgetApi.getOption.bind(widgetApi); +export const setOption = widgetApi.setOption.bind(widgetApi); +export const setOptions = widgetApi.setOptions.bind(widgetApi); +export const getOptions = widgetApi.getOptions.bind(widgetApi); +export const clearOptions = widgetApi.clearOptions.bind(widgetApi); + // For custom widgets that support custom columns mappings store current configuration // in a memory.