Skip to main content
Only NOTE files have layer data; other file types do not.
static sortLayers(NOTEPath: string, page: number, layerIds: number[]): Promise<APIResponse<boolean>>;
Parameters
ParameterTypeDescription
NOTEPathstringNOTE file path
pagenumberPage index (starts from 0)
layerIdsnumber[]Layer ID order (0..3)
Returns

Example

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

/**
 * Example: sort layers (pass the desired layer order).
 */
export async function exampleSortLayers() {
 const NOTEPath = '/storage/emulated/0/Note/demo.note';
 const page = 1;
 const res = await PluginFileAPI.sortLayers(NOTEPath, page, [2, 1, 0]);
 if (!res.success) {
 throw new Error(res.error?.message ?? 'sortLayers call failed');
 }
 return res.result;
}