Skip to main content
Some fields in Element can be very large (e.g. stroke sample points, pressure points, angle points, contour points). To avoid RN-side memory issues caused by loading large datasets at once, the SDK uses an accessor design. Therefore you should create elements via createElement. For details, see Element.
static createElement(
 type: number
): Promise<APIResponse<Element>>;
Parameters
ParameterTypeDescription
typenumberElement type. See ElementType.
Returns

Example

import { PluginCommAPI } from 'sn-plugin-lib';

/**
 * Create one Element example.
 */
export async function exampleCreateElement() {

 const res = await PluginCommAPI.createElement(0);
 if (!res.success) {
 throw new Error(res.error?.message ?? 'createElement call failed');
 }
 return res.result;
}