Capacitor plugin for communication between Capacitor app and iOS and Android widgets
capacitor-widget-bridge
Capacitor plugin to interact with ios widgetkit
Install
npm install capacitor-widget-bridge
npx cap sync
API
getItem(…)
getItem(options: UserDefaultsOptions) => Promise<DataResults<any>>
Return the value from user’s defaults database associated with the specified key
Param | Type |
---|---|
options |
UserDefaultsOptions |
Returns: Promise<DataResults<any>>
Since: 1.0.0
setItem(…)
setItem(options: UserDefaultsOptions) => Promise<DataResults<boolean>>
Set the value to user’s defaults database associated with the specified key
Param | Type |
---|---|
options |
UserDefaultsOptions |
Returns: Promise<DataResults<boolean>>
Since: 1.0.0
removeItem(…)
removeItem(options: UserDefaultsOptions) => Promise<DataResults<boolean>>
Remove the value from user’s defaults database associated with the specified key
Param | Type |
---|---|
options |
UserDefaultsOptions |
Returns: Promise<DataResults<boolean>>
Since: 1.0.0
reloadAllTimelines()
reloadAllTimelines() => Promise<DataResults<boolean>>
Reloads the timelines for all configured widgets belonging to the containing app
Returns: Promise<DataResults<boolean>>
Since: 1.0.0
reloadTimelines(…)
reloadTimelines(options: TimelinesOptions) => Promise<DataResults<boolean>>
Reloads the timelines for all widgets of a particular kind
Param | Type |
---|---|
options |
TimelinesOptions |
Returns: Promise<DataResults<boolean>>
Since: 1.0.0
Interfaces
DataResults
Prop | Type | Description | Since |
---|---|---|---|
results |
T |
Holds response results from native code | 1.0.0 |
UserDefaultsOptions
Prop | Type | Description | Since |
---|---|---|---|
key |
string |
The key whose value to retrieve from storage. | 1.0.0 |
group |
string |
User defaults database name which holds and organizes key/value pairs | 1.0.0 |
value |
string |
The value to set in storage with the associated key | 1.0.0 |
TimelinesOptions
Prop | Type | Description | Since |
---|---|---|---|
ofKind |
string |
A string that identifies the widget and matches the value you used when you created the widget’s configuration | 1.0.0 |
example keys and group:
group.com.example.secrets
my-secret-api-key