Event!string onStringChange; onStringChange ~= (s) { assert(s == "Foo"); }; onStringChange.emit("Foo");
Cancelable!int onIntChange; int changed = 0; onIntChange ~= (i) { if(i > 5) return false; changed++; return true; }; onIntChange ~= (i) { if(i > 4) return false; changed++; return true; }; onIntChange ~= (i) { if(i > 3) return false; changed++; return true; }; assert(onIntChange.emit(2)); assert(changed == 3); changed = 0; assert(!onIntChange.emit(4)); assert(changed == 2);
Calls all functions in a cancelable event