ns-observable-array-change-events

Installation
SKILL.md

ObservableArray change events: the action table

ObservableArray emits one change event per mutation with ChangedData<T>: { action, index, addedCount, removed }. The four actions are the string literals 'add', 'delete', 'update', 'splice'. A handler that only switches on 'add'/'delete' silently misses every length = mutation — those are 'splice'.

import { ChangedData, ObservableArray } from '@nativescript/core';

const items = new ObservableArray(['a', 'b', 'c']);
items.on(ObservableArray.changeEvent, (args: ChangedData<string>) => {
  if (args.action === 'splice') {
    rebuildAll(); // covers items.length = N in both directions
  } else {
    patchRows(args.index, args.addedCount, args.removed);
  }
});
items.length = 0; // -> action 'splice', index 0, addedCount 0, removed ['a','b','c']

What each mutation reports

Installs
20
GitHub Stars
1
First Seen
Aug 28, 2026
ns-observable-array-change-events — nativescript/skills