1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16interface PeerChangeEventReceiverPU<T> { 17 /** 18 * emitted by sync peer when it changes 19 * @Prop - SynchedPropertySimple/ObjectOneWay: ObservedPropertyAbstractPU in parent 20 * @Link - SynchedPropertySimple/ObjectTwoWay: ObservedPropertyAbstractPU in parent 21 * 22 * ObservedPropertyAbstractPU given as source has changed ('set') 23 * the new value is available via ObservedPropertyAbstractPU.Get() 24 * or ObservedPropertyAbstractPU.GetUnmonitored() 25 * the property name is available via ObservedPropertyAbstractPU.Info() 26 * @see ObservedPropertyAbstractPU.notifyPropertryHasChangedPU() 27 * @param eventSource The 28 */ 29 syncPeerHasChanged(eventSource: ObservedPropertyAbstractPU<T>): void; 30 31 syncPeerTrackedPropertyHasChanged(eventSource: ObservedPropertyAbstractPU<T>, changedTrackedObjectPropertyName: string): void; 32} 33 34interface PropertyReadEventListener<T> { 35 /** 36 * ObservedPropertyAbstractPU given as source has been read ('get') 37 * @param eventSource 38 */ 39 propertyHasBeenReadPU(eventSource: ObservedPropertyAbstractPU<T>); 40} 41 42 43/** 44 * Events generated by an ObservedObject 45 */ 46interface ObservedObjectEventsPUReceiver<C extends Object> { 47 // called from ObservedObject proxy when property has changes 48 // for class objects when in compatibility mode 49 // for Array, Date instances always 50 onTrackedObjectPropertyCompatModeHasChangedPU?(eventSource: ObservedObject<C>, changedPropName: string); 51 52 // called from ObservedObject proxy when @Track property has changes 53 onTrackedObjectPropertyHasChangedPU?(eventSource: ObservedObject<C>, changedPropName: string); 54} 55 56