Bridge Module
The Bridge
module mainly involves the API at the plugin application level, such as (accessing persistent data/getting current multidimensional table theme information, etc.), The way to obtain it is:
const bridge = bitable.bridge;
const bridge = bitable.bridge;
onThemeChange
onThemeChange(callback: (ev: IEventCbCtx<ThemeModeCtx>) => void): () => void;
onThemeChange(callback: (ev: IEventCbCtx<ThemeModeCtx>) => void): () => void;
Listen for theme changes
getPersonalBaseToken
getPersonalBaseToken: () => Promise<string>;
getPersonalBaseToken: () => Promise<string>;
Get PersonalBaseToken
getData
getData(): Promise<unknown>;
getData(): Promise<unknown>;
Read persistent data
setData
setData(data: Record<string, unknown>): Promise<void>;
setData(data: Record<string, unknown>): Promise<void>;
Write persistent data, it needs to be written in the form of an object key
:value
getBitableUrl
getBitableUrl(options: GetBitableUrlOptions): Promise<string>;
getBitableUrl(options: GetBitableUrlOptions): Promise<string>;
Generate a multidimensional table link, where the type parameter of GetBitableUrlOptions
is defined as:
type GetBitableUrlOptions = {
tableId: string,
viewId: string,
// Open the table when recordId is empty, open the card when it is not empty
recordId?: string,
fieldId?: string,
}
type GetBitableUrlOptions = {
tableId: string,
viewId: string,
// Open the table when recordId is empty, open the card when it is not empty
recordId?: string,
fieldId?: string,
}
getUserId
getUserId(): Promise<string>;
getUserId(): Promise<string>;
Get the current user ID
getTheme
getTheme(): Promise<ThemeModeType>;
getTheme(): Promise<ThemeModeType>;
Get the current theme, where the ThemeModeType
type is defined as follows:
declare enum ThemeModeType {
LIGHT = "LIGHT",
DARK = "DARK"
}
declare enum ThemeModeType {
LIGHT = "LIGHT",
DARK = "DARK"
}
getLocale
getLocale(): Promise<Locale>;
getLocale(): Promise<Locale>;
Get the Locale
information, where the Locale
type is defined as follows:
type Locale = 'zh-CN' | 'zh-TW' | 'zh-HK' | 'en-US' | 'ja-JP' | 'fr-FR' | 'hi-IN' | 'id-ID' | 'it-IT' | 'ko-KR' | 'pt-BR' | 'ru-RU' | 'th-TH' | 'vi-VN' | 'de-DE' | 'es-ES';
type Locale = 'zh-CN' | 'zh-TW' | 'zh-HK' | 'en-US' | 'ja-JP' | 'fr-FR' | 'hi-IN' | 'id-ID' | 'it-IT' | 'ko-KR' | 'pt-BR' | 'ru-RU' | 'th-TH' | 'vi-VN' | 'de-DE' | 'es-ES';
getLanguage
getLanguage(): Promise<Language>;
getLanguage(): Promise<Language>;
Get the current language information, where the Language
type is defined as follows:
type Language = 'zh' | 'zh-TW' | 'zh-HK' | 'en' | 'ja' | 'fr' | 'hi' | 'id' | 'it' | 'ko' | 'pt' | 'ru' | 'th' | 'vi' | 'de' | 'es';
type Language = 'zh' | 'zh-TW' | 'zh-HK' | 'en' | 'ja' | 'fr' | 'hi' | 'id' | 'it' | 'ko' | 'pt' | 'ru' | 'th' | 'vi' | 'de' | 'es';
getTenantKey
getTenantKey(): Promise<string>;
getTenantKey(): Promise<string>;
Get the Id
of the current tenant
getEnv
getEnv(): Promise<Env>;
getEnv(): Promise<Env>;
Get the current environment information, where the Env
type is defined as follows:
type Product = 'lark' | 'feishu';
interface Env {
product: Product;
}
type Product = 'lark' | 'feishu';
interface Env {
product: Product;
}
getInstanceId
getInstanceId(): Promise<string>;
getInstanceId(): Promise<string>;
Get the current plugin instance Id