@twinfinity/core
    Preparing search index...

    Interface MergableObjectOperations<T>

    Operations that a MergableObject must implement

    interface MergableObjectOperations<T> {
        clone(): T;
        isEqual(o: T): boolean;
        onAdded(o: MergableObjectEventArgs<T>): void;
        onDelete(o: MergableObjectEventArgs<T>): void;
        onUpdate(o: MergableObjectEventArgs<T>): void;
    }

    Type Parameters

    • T
    Index

    Methods

    • Deep clone the object.

      Returns T

    • Returns true if objects are considered to be equal. Otherwise false

      Parameters

      • o: T

        Object to compare with.

      Returns boolean

    • Called when

      • Layer.delete is called.
      • Layer.save or Layer.load is called and item exists in client (and is unchanged) but no longer in backend. That means that somebody has removed it and store that in the backend. Hence it must be removed

      Parameters

      • o: MergableObjectEventArgs<T>

        Gives both local and (optional) remote representation of object. Also gives (rare but possible) conflict reason if it exists. A conflict may occur if a local object with same MergableObject.id has been added by calling .addOrUpdate when no remote counterpart existed. Once .saveAndMerge or .loadAndMerge is called a remote counter part (same id) is detected and their content differs. This should only happen if non unique id's are assigned to objects.

      Returns void

      true if there is no conflict or conflict could be resolved.