• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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
16type PropertyInfo = string;
17
18/*
19  an instance that gets and sets the value of an IProperty
20  these are OneWaySyncedProperty, SyncedPropertyTwoWay
21  and (to be designed) View
22*/
23interface IPropertySubscriber {
24
25  // globally unique id
26  id__(): number;
27
28  // inform the subscribed property
29  // that the subscriber is about to be deleted
30  // hence , unsubscribe
31  aboutToBeDeleted(owningView?: IPropertySubscriber): void;
32}
33
34interface ISinglePropertyChangeSubscriber<T> extends IPropertySubscriber {
35  // get informed after the property has changed.
36  hasChanged(newValue: T): void;
37}
38
39interface IMultiPropertiesChangeSubscriber extends IPropertySubscriber {
40  // get informed that given property has changed.
41  // Note: a Property's PropertyInfo can be undefined.
42  propertyHasChanged(info?: PropertyInfo): void;
43}
44
45interface IMultiPropertiesReadSubscriber extends IPropertySubscriber {
46  // get informed that given property has been read (get access).
47  // Note: a Property's PropertyInfo can be undefined.
48  propertyRead(info?: PropertyInfo): void;
49}
50