Added more documentation. Fixed bugs with pagination to better support push, and slice.

This commit is contained in:
2023-04-18 15:38:49 -07:00
parent 3383001c3a
commit 4203884aff
2 changed files with 91 additions and 36 deletions

View File

@ -295,62 +295,116 @@ class IgniteProperty {
IgniteRendering.pop();
}
/**
* Attaches a callback function to be invoked when this property value changes.
* @param {Function(oldvalue, newValue)} onChange Callback function to be invoked.
* @returns {IgniteCallback} A new ignite callback.
*/
attachOnChange(onChange) {
var callback = new IgniteCallback(onChange, detach => this.detachOnChange(detach));
this.onChangeCallbacks.push(callback);
return callback;
}
/**
* Attaches a callback function to be invoked when a set of items are pushed to this properties value.
* @param {Function(array, items)} onPush Callback function to be invoked.
* @returns {IgniteCallback} A new ignite callback.
*/
attachOnPush(onPush) {
var callback = new IgniteCallback(onPush, detach => this.detachOnPush(detach));
this.onPushCallbacks.push(callback);
return callback;
}
/**
* Attaches a callback function to be invoked when an item is popped from this properties value.
* @param {Function} onPop Callback function to be invoked.
* @returns {IgniteCallback} A new ignite callback.
*/
attachOnPop(onPop) {
var callback = new IgniteCallback(onPop, detach => this.detachOnPop(detach));
this.onPopCallbacks.push(callback);
return callback;
}
/**
* Attaches a callback function to be invoked when items are shifted from this properties value.
* @param {Function} onShift Callback function to be invoked.
* @returns {IgniteCallback} A new ignite callback.
*/
attachOnShift(onShift) {
var callback = new IgniteCallback(onShift, detach => this.detachOnShift(detach));
this.onShiftCallbacks.push(callback);
return callback;
}
/**
* Attaches a callback function to be invoked when items are unshifted to this properties value.
* @param {Function(array, items)} onUnshift Callback function to be invoked.
* @returns {IgniteCallback} A new ignite callback.
*/
attachOnUnshift(onUnshift) {
var callback = new IgniteCallback(onUnshift, detach => this.detachOnUnshift(detach));
this.onUnshiftCallbacks.push(callback);
return callback;
}
/**
* Attaches a callback function to be invoked when items are spliced on this properties value.
* @param {Function(array, start, deleteCount, items)} onSplice Callback function to be invoked.
* @returns {IgniteCallback} A new ignite callback.
*/
attachOnSplice(onSplice) {
var callback = new IgniteCallback(onSplice, detach => this.detachOnSplice(detach));
this.onSpliceCallbacks.push(callback);
return callback;
}
/**
* Removes an ignite callback for the OnChange event.
* @param {IgniteCallback} callback
*/
detachOnChange(callback) {
this.onChangeCallbacks = this.onChangeCallbacks.filter(change => change != callback);
}
/**
* Removes an ignite callback for the OnPush event.
* @param {Ignitec} callback
*/
detachOnPush(callback) {
this.onPushCallbacks = this.onPushCallbacks.filter(push => push != callback);
}
/**
* Removes an ignite callback for the OnPop event.
* @param {IgniteCallback} callback
*/
detachOnPop(callback) {
this.onPopCallbacks = this.onPopCallbacks.filter(pop => pop != callback);
}
/**
* Removes an ignite callback for the OnShift event.
* @param {IgniteCallback} callback
*/
detachOnShift(callback) {
this.onShiftCallbacks = this.onShiftCallbacks.filter(shift => shift != callback);
}
/**
* Removes an ignite callback for the OnUnshift event.
* @param {IgniteCallback} callback
*/
detachOnUnshift(callback) {
this.onUnshiftCallbacks = this.onUnshiftCallbacks.filter(unshift => unshift != callback);
}
/**
* Removes an ignite callback for the OnSplice event.
* @param {IgniteCallback} callback
*/
detachOnSplice(callback) {
this.onSpliceCallbacks = this.onSpliceCallbacks.filter(slice => slice != callback);
}