• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 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
16/**
17 * AppStorage singleton is sub-class of see LocalStorage for
18 * UI state of app-wide access and same life cycle as the app.
19 *
20 * @since 7
21 */
22/**
23 * AppStorage singleton is sub-class of see LocalStorage for
24 * UI state of app-wide access and same life cycle as the app.
25 *
26 * @crossplatform
27 * @since 10
28 */
29declare class AppStorage {
30  /**
31   * Called when a link is set.
32   *
33   * @param { string } propName
34   * @returns { any }
35   * @syscap SystemCapability.ArkUI.ArkUI.Full
36   * @since 7
37   * @deprecated since 10
38   * @useinstead AppStorage#link
39   */
40  static Link(propName: string): any;
41
42  /**
43   * Create and return a two-way sync "(link") to named property
44   * Same as @see LocalStorage.link()
45   *
46   * @param { string } propName - name of source property in AppStorage
47   * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T>
48   *           return 'undefined' if named property does not already exist in AppStorage
49   * @syscap SystemCapability.ArkUI.ArkUI.Full
50   * @crossplatform
51   * @since 10
52   */
53  static link<T>(propName: string): SubscribedAbstractProperty<T>;
54
55  /**
56   * @param { string } propName
57   * @param { T } defaultValue
58   * @returns { SubscribedAbstractProperty<T> }
59   * @syscap SystemCapability.ArkUI.ArkUI.Full
60   * @since 7
61   * @deprecated since 10
62   * @useinstead AppStorage#setAndLink
63   * @see setAndLink
64   */
65  static SetAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>;
66
67  /**
68   * Like see @link(), but will create and initialize a new source property in AppStorage if missing
69   * Same as see LocalStorage.setAndLink()
70   *
71   * @param { string } propName - name of source property in AppStorage
72   * @param { T } defaultValue - value to be used for initializing if new creating new property in AppStorage
73   *        default value must be of type T, must not be 'undefined' or 'null'.
74   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
75   * @syscap SystemCapability.ArkUI.ArkUI.Full
76   * @crossplatform
77   * @since 10
78   */
79  static setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>;
80
81  /**
82   * Called when a property is set.
83   *
84   * @param { string } propName
85   * @returns { any }
86   * @syscap SystemCapability.ArkUI.ArkUI.Full
87   * @since 7
88   * @deprecated since 10
89   * @useinstead AppStorage#prop
90   */
91  static Prop(propName: string): any;
92
93  /**
94   * Create and return a one-way sync ('prop') to named property
95   * Same as @see LocalStorage.prop()
96   *
97   * @param { string } propName - name of source property in AppStorage
98   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
99   *           return undefined if named property does not already exist in AppStorage.
100   * @syscap SystemCapability.ArkUI.ArkUI.Full
101   * @crossplatform
102   * @since 10
103   */
104  static prop<T>(propName: string): SubscribedAbstractProperty<T>;
105
106  /**
107   * @param { string } propName
108   * @param { S } defaultValue
109   * @returns { SubscribedAbstractProperty<S> }
110   * @syscap SystemCapability.ArkUI.ArkUI.Full
111   * @since 7
112   * @deprecated since 10
113   * @useinstead AppStorage#setAndProp
114   * @see setAndProp
115   */
116  static SetAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S>;
117
118  /**
119   * @param { string } propName - name of source property in AppStorage
120   * @param { T } defaultValue - value to be used for initializing if new creating new property in AppStorage.
121   *        default value must be of type T, must not be undefined or null.
122   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
123   *           return undefined if named property does not already exist in AppStorage.
124   * @syscap SystemCapability.ArkUI.ArkUI.Full
125   * Like @see prop(), will create and initialize a new source property in AppStorage if missing
126   * Same as see LocalStorage.setAndProp()
127   * @crossplatform
128   * @since 10
129   */
130  static setAndProp<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>;
131
132  /**
133   * @param { string } propName
134   * @returns { boolean }
135   * @syscap SystemCapability.ArkUI.ArkUI.Full
136   * @since 7
137   * @deprecated since 10
138   * @useinstead AppStorage#has
139   * @see has
140   */
141  static Has(propName: string): boolean;
142
143  /**
144   * Checks if AppStorage has a property with given name
145   * returns true if property with given name exists
146   * same as ES6 Map.prototype.has()
147   * Same as see LocalStorage.has()
148   *
149   * @param { string } propName - searched property
150   * @returns { boolean } true if property with such name exists in AppStorage
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @crossplatform
153   * @since 10
154   */
155  static has(propName: string): boolean;
156
157  /**
158   * @param { string } propName
159   * @returns { T | undefined }
160   * @syscap SystemCapability.ArkUI.ArkUI.Full
161   * @since 7
162   * @deprecated since 10
163   * @useinstead AppStorage#get
164   * @see get
165   */
166  static Get<T>(propName: string): T | undefined;
167
168  /**
169   * Same as see LocalStorage.get()
170   * Obtain the value of property with given name, returns undefined if the property does not exist in AppStorage.
171   *
172   * @param { string } propName
173   * @returns { T | undefined } property value of type T if found or undefined
174   * @syscap SystemCapability.ArkUI.ArkUI.Full
175   * @crossplatform
176   * @since 10
177   */
178  static get<T>(propName: string): T | undefined;
179
180  /**
181   * @param { string } propName
182   * @param { T } newValue
183   * @returns { boolean }
184   * @syscap SystemCapability.ArkUI.ArkUI.Full
185   * @since 7
186   * @deprecated since 10
187   * @useinstead AppStorage#set
188   * @see set
189   */
190  static Set<T>(propName: string, newValue: T): boolean;
191
192  /**
193   * Set value of given property in AppStorage
194   * Method sets nothing and returns false if property with this name does not exist
195   * or if newValue is `undefined` or `null`.
196   * Same as see LocalStorage.set
197   *
198   * @param { string } propName
199   * @param { T } newValue - must be of type T and must not be undefined or null
200   * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false
201   * @syscap SystemCapability.ArkUI.ArkUI.Full
202   * @crossplatform
203   * @since 10
204   */
205  static set<T>(propName: string, newValue: T): boolean;
206
207  /**
208   * @param { string } propName
209   * @param { T } newValue
210   * @syscap SystemCapability.ArkUI.ArkUI.Full
211   * @since 7
212   * @deprecated since 10
213   * @useinstead AppStorage#setOrCreate
214   * @see setOrCreate
215   */
216  static SetOrCreate<T>(propName: string, newValue: T): void;
217
218  /**
219   * Set value of given property, if it exists, see set() .
220   * Add property if no property with given name in AppStorage,. yet, and initialize with given value.
221   * Do nothing and return false if newValue is undefined or null
222   * see LocalStorage.setOrCreate()
223   *
224   * @param { string } propName
225   * @param { T } newValue - must be of type T and must not be undefined or null
226   * @syscap SystemCapability.ArkUI.ArkUI.Full
227   * @crossplatform
228   * @since 10
229   */
230  static setOrCreate<T>(propName: string, newValue: T): void;
231
232  /**
233   * @param { string } propName
234   * @returns { boolean }
235   * @syscap SystemCapability.ArkUI.ArkUI.Full
236   * @since 7
237   * @deprecated since 10
238   * @useinstead AppStorage#delete
239   * @see delete
240   */
241  static Delete(propName: string): boolean;
242
243  /**
244   * Delete property with given name from AppStorage
245   * Use with caution:
246   * Before deleting a prop from AppStorage all its subscribers need to
247   * unsubscribe from the property.
248   * This method fails and returns false if given property still has subscribers
249   * Another reason for failing is unknown property name.
250   * Developer advise:
251   * Subscribers to a property in AppStorage are created with see link(), see prop()
252   * and also via @StorageLink and @StorageProp state variable decorators.
253   * That means as long as their is a @Component instance that uses such decorated variable
254   * or a sync relationship with a SubscribedAbstractProperty variable the property can not
255   * (and also should not!) be deleted from AppStorage.
256   * Same as see LocalStorage.delete()
257   *
258   * @param { string } propName
259   * @returns { boolean } false if method failed
260   * @syscap SystemCapability.ArkUI.ArkUI.Full
261   * @crossplatform
262   * @since 10
263   */
264  static delete(propName: string): boolean;
265
266  /**
267   * @returns { IterableIterator<string> }
268   * @syscap SystemCapability.ArkUI.ArkUI.Full
269   * @since 7
270   * @deprecated since 10
271   * @useinstead AppStorage#keys
272   * @see keys
273   */
274  static Keys(): IterableIterator<string>;
275
276  /**
277   * Provide names of all properties in AppStorage
278   * same as ES6 Map.prototype.keys()
279   * Same as see LocalStorage.keys()
280   *
281   * @returns { IterableIterator<string> } return a Map Iterator
282   * @syscap SystemCapability.ArkUI.ArkUI.Full
283   * @crossplatform
284   * @since 10
285   */
286  static keys(): IterableIterator<string>;
287
288  /**
289   * Called when a cleanup occurs.
290   *
291   * @returns { boolean }
292   * @syscap SystemCapability.ArkUI.ArkUI.Full
293   * @since 7
294   * @deprecated since 9
295   * @useinstead AppStorage.Clear
296   */
297  static staticClear(): boolean;
298
299  /**
300   * @returns { boolean }
301   * @syscap SystemCapability.ArkUI.ArkUI.Full
302   * @since 9
303   * @deprecated since 10
304   * @useinstead AppStorage#clear
305   * @see clear
306   */
307  static Clear(): boolean;
308
309  /**
310   * Delete all properties from the AppStorage.
311   * Precondition is that there are no subscribers, see Delete().
312   *
313   * @returns { boolean } false and deletes no properties if there is any property
314   * that still has subscribers.
315   * @syscap SystemCapability.ArkUI.ArkUI.Full
316   * @crossplatform
317   * @since 10
318   */
319  static clear(): boolean;
320
321  /**
322   * Called when the data can be changed.
323   *
324   * @param { string } propName
325   * @returns { boolean }
326   * @syscap SystemCapability.ArkUI.ArkUI.Full
327   * @since 7
328   * @deprecated since 10
329   */
330  static IsMutable(propName: string): boolean;
331
332  /**
333   * @returns { number }
334   * @syscap SystemCapability.ArkUI.ArkUI.Full
335   * @since 7
336   * @deprecated since 10
337   * @useinstead AppStorage#size
338   * @see size
339   */
340  static Size(): number;
341
342  /**
343   * Method returns the number of properties currently in AppStorage
344   *
345   * @returns { number } Returns the number of properties currently in AppStorage
346   * @syscap SystemCapability.ArkUI.ArkUI.Full
347   * @crossplatform
348   * @since 10
349   */
350  static size(): number;
351}
352
353/**
354 * Defines the subscribed abstract property.
355 *
356 * @syscap SystemCapability.ArkUI.ArkUI.Full
357 * @systemapi
358 * @since 7
359 */
360/**
361 *   SubscribedAbstractProperty<T> is the return value of
362 *   - AppStorage static functions Link(), Prop(), SetAndLink(), and SetAndProp()
363 *   - LocalStorage member methods link(), prop(), setAndLink(), and setAndProp()
364 *   'T' can be boolean, string, number or custom class.
365 * Main functions
366 *   see get() reads the linked AppStorage/LocalStorage property value,
367 *   see set(newValue) write a new value to the synched AppStorage/LocalStorage property
368 *   see aboutToBeDeleted() ends the sync relationship with the AppStorage/LocalStorage property
369 *        The app must call this function before the SubscribedAbstractProperty<T> object
370 *        goes out of scope.
371 *
372 * @syscap SystemCapability.ArkUI.ArkUI.Full
373 * @since 9
374 * @form
375 */
376/**
377 *   SubscribedAbstractProperty<T> is the return value of
378 *   - AppStorage static functions Link(), Prop(), SetAndLink(), and SetAndProp()
379 *   - LocalStorage member methods link(), prop(), setAndLink(), and setAndProp()
380 *   'T' can be boolean, string, number or custom class.
381 * Main functions
382 *   see get() reads the linked AppStorage/LocalStorage property value,
383 *   see set(newValue) write a new value to the synched AppStorage/LocalStorage property
384 *   see aboutToBeDeleted() ends the sync relationship with the AppStorage/LocalStorage property
385 *        The app must call this function before the SubscribedAbstractProperty<T> object
386 *        goes out of scope.
387 *
388 * @syscap SystemCapability.ArkUI.ArkUI.Full
389 * @crossplatform
390 * @since 10
391 * @form
392 */
393declare abstract class SubscribedAbstractProperty<T> {
394  /**
395   * Setting Subscribers.
396   *
397   * @type { Set<number> }
398   * @syscap SystemCapability.ArkUI.ArkUI.Full
399   * @systemapi
400   * @since 7
401   */
402  protected subscribers_: Set<number>;
403
404  /**
405   * Private user ID.
406   *
407   * @syscap SystemCapability.ArkUI.ArkUI.Full
408   * @systemapi
409   * @since 7
410   */
411  private id_;
412
413  /**
414   * Private user information.
415   *
416   * @syscap SystemCapability.ArkUI.ArkUI.Full
417   * @systemapi
418   * @since 7
419   */
420  private info_?;
421
422  /**
423   * @param { IPropertySubscriber } subscribeMe
424   * @param { string } info
425   * @syscap SystemCapability.ArkUI.ArkUI.Full
426   * @systemapi
427   * @since 7
428   */
429  constructor(
430    /**
431     * Subscriber IPropertySubscriber.
432     *
433     * @syscap SystemCapability.ArkUI.ArkUI.Full
434     * @systemapi
435     * @since 7
436     *
437     */
438    subscribeMe?: IPropertySubscriber,
439    /**
440     * Subscriber info.
441     *
442     * @syscap SystemCapability.ArkUI.ArkUI.Full
443     * @systemapi
444     * @since 7
445     *
446     */
447    info?: string,
448  );
449
450  /**
451   * Called when the subscriber ID is entered.
452   *
453   * @returns { number }
454   * @syscap SystemCapability.ArkUI.ArkUI.Full
455   * @systemapi
456   * @since 7
457   */
458  id(): number;
459
460  /**
461   * Returns the property name,
462   * e.g. let link = AppStorage.Link("foo") then link.info() == "foo"
463   *
464   * @returns { string } the property name if set or undefined
465   * @syscap SystemCapability.ArkUI.ArkUI.Full
466   * @crossplatform
467   * @since 10
468   */
469  info(): string;
470
471  /**
472   * Reads value of the sync'ed AppStorage/LocalStorage property.
473   * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")`
474   * then `link.get()` returns the value of "foo" property in AppStorage.
475   *
476   * @returns { T } the value of the sync'ed AppStorage/LocalStorage property.
477   * @syscap SystemCapability.ArkUI.ArkUI.Full
478   * @since 9
479   * @form
480   */
481  /**
482   * Reads value of the sync'ed AppStorage/LocalStorage property.
483   * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")`
484   * then `link.get()` returns the value of "foo" property in AppStorage.
485   *
486   * @returns { T } the value of the sync'ed AppStorage/LocalStorage property.
487   * @syscap SystemCapability.ArkUI.ArkUI.Full
488   * @crossplatform
489   * @since 10
490   * @form
491   */
492  abstract get(): T;
493
494  /**
495   * Updates the value of value of the sync'ed AppStorage/LocalStorage property.
496   * Sets new value, must be of type T, and must not be 'undefined' or 'null'.
497   * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")`
498   * then `link.set("Hello")` will set the value of "foo" property in AppStorage.
499   *
500   * @param { T } newValue
501   * @syscap SystemCapability.ArkUI.ArkUI.Full
502   * @since 9
503   * @form
504   */
505  /**
506   * Updates the value of value of the sync'ed AppStorage/LocalStorage property.
507   * Sets new value, must be of type T, and must not be 'undefined' or 'null'.
508   * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")`
509   * then `link.set("Hello")` will set the value of "foo" property in AppStorage.
510   *
511   * @param { T } newValue
512   * @syscap SystemCapability.ArkUI.ArkUI.Full
513   * @crossplatform
514   * @since 10
515   * @form
516   */
517  abstract set(newValue: T): void;
518
519  /**
520   * Called when a two-way synchronization is created.
521   *
522   * @param { IPropertySubscriber } subscribeMe
523   * @param { string } info
524   * @returns { SyncedPropertyTwoWay<T> }
525   * @syscap SystemCapability.ArkUI.ArkUI.Full
526   * @systemapi
527   * @since 7
528   */
529  createTwoWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyTwoWay<T>;
530
531  /**
532   * Called when a one-way synchronization is created.
533   *
534   * @param { IPropertySubscriber } subscribeMe
535   * @param { string } info
536   * @returns { SyncedPropertyOneWay<T> }
537   * @syscap SystemCapability.ArkUI.ArkUI.Full
538   * @systemapi
539   * @since 7
540   */
541  createOneWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyOneWay<T>;
542
543  /**
544   * Called when the subscriber is unlinked.
545   *
546   * @param { number } subscriberId
547   * @syscap SystemCapability.ArkUI.ArkUI.Full
548   * @systemapi
549   * @since 7
550   */
551  unlinkSuscriber(subscriberId: number): void;
552
553  /**
554   * Called when the notification has changed.
555   *
556   * @param { T } newValue
557   * @syscap SystemCapability.ArkUI.ArkUI.Full
558   * @systemapi
559   * @since 7
560   */
561  protected notifyHasChanged(newValue: T): void;
562
563  /**
564   * Called when the notification property is read.
565   *
566   * @syscap SystemCapability.ArkUI.ArkUI.Full
567   * @systemapi
568   * @since 7
569   */
570  protected notifyPropertyRead(): void;
571
572  /**
573   * Called when the number of users is queried.
574   *
575   * @returns { number }
576   * @syscap SystemCapability.ArkUI.ArkUI.Full
577   * @systemapi
578   * @since 7
579   */
580  numberOfSubscrbers(): number;
581
582  /**
583   * An app needs to call this function before the instance of SubscribedAbstractProperty
584   * goes out of scope / is subject to garbage collection. Its purpose is to unregister the
585   * variable from the two-way/one-way sync relationship that AppStorage/LocalStorage.link()/prop()
586   * and related functions create.
587   *
588   * @syscap SystemCapability.ArkUI.ArkUI.Full
589   * @crossplatform
590   * @since 10
591   */
592  abstract aboutToBeDeleted(): void;
593}
594
595/**
596 * Provides an interface for attribute subscribers.
597 *
598 * @interface IPropertySubscriber
599 * @syscap SystemCapability.ArkUI.ArkUI.Full
600 * @systemapi
601 * @since 7
602 */
603interface IPropertySubscriber {
604  /**
605   * Called when the ID of the property subscriber is queried.
606   *
607   * @returns { number }
608   * @syscap SystemCapability.ArkUI.ArkUI.Full
609   * @systemapi
610   * @since 7
611   */
612  id(): number;
613
614  /**
615   * Provides a single attribute change user interface.
616   *
617   * @param { IPropertySubscriber } owningView
618   * @syscap SystemCapability.ArkUI.ArkUI.Full
619   * @systemapi
620   * @since 7
621   */
622  aboutToBeDeleted(owningView?: IPropertySubscriber): void;
623}
624
625/**
626 * Defines the state value.
627 *
628 * @extends SubscribedAbstractProperty
629 * @syscap SystemCapability.ArkUI.ArkUI.Full
630 * @systemapi
631 * @since 7
632 */
633declare class SyncedPropertyTwoWay<T>
634  extends SubscribedAbstractProperty<T>
635  implements ISinglePropertyChangeSubscriber<T>
636{
637  /**
638   * Sources of synchronization attributes bidirectionally.
639   *
640   * @syscap SystemCapability.ArkUI.ArkUI.Full
641   * @systemapi
642   * @since 7
643   */
644  private source_;
645
646  /**
647   * constructor parameters.
648   *
649   * @param { SubscribedAbstractProperty<T> } source
650   * @param { IPropertySubscriber } subscribeMe
651   * @param { string } info
652   * @syscap SystemCapability.ArkUI.ArkUI.Full
653   * @systemapi
654   * @since 7
655   */
656  constructor(source: SubscribedAbstractProperty<T>, subscribeMe?: IPropertySubscriber, info?: string);
657
658  /**
659   * Called when processing information about to be deleted.
660   *
661   * @param { IPropertySubscriber } unsubscribeMe
662   * @syscap SystemCapability.ArkUI.ArkUI.Full
663   * @systemapi
664   * @since 7
665   */
666  aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void;
667
668  /**
669   * Information Changed.
670   *
671   * @param { T } newValue
672   * @syscap SystemCapability.ArkUI.ArkUI.Full
673   * @systemapi
674   * @since 7
675   */
676  hasChanged(newValue: T): void;
677
678  /**
679   * Called when data is obtained.
680   *
681   * @returns { T }
682   * @syscap SystemCapability.ArkUI.ArkUI.Full
683   * @systemapi
684   * @since 7
685   */
686  get(): T;
687
688  /**
689   * Called when data is created.
690   *
691   * @param { T } newValue
692   * @syscap SystemCapability.ArkUI.ArkUI.Full
693   * @systemapi
694   * @since 7
695   */
696  set(newValue: T): void;
697}
698
699/**
700 * Defines the prop state value.
701 *
702 * @extends SubscribedAbstractProperty
703 * @syscap SystemCapability.ArkUI.ArkUI.Full
704 * @systemapi
705 * @since 7
706 */
707declare class SyncedPropertyOneWay<T>
708  extends SubscribedAbstractProperty<T>
709  implements ISinglePropertyChangeSubscriber<T>
710{
711  /**
712   * Pack value for single-item binding.
713   *
714   * @syscap SystemCapability.ArkUI.ArkUI.Full
715   * @systemapi
716   * @since 7
717   */
718  private wrappedValue_;
719
720  /**
721   * Sources of synchronization attributes bidirectionally.
722   *
723   * @syscap SystemCapability.ArkUI.ArkUI.Full
724   * @systemapi
725   * @since 7
726   */
727  private source_;
728
729  /**
730   * Constructor parameters.
731   *
732   * @param { SubscribedAbstractProperty<T> } source
733   * @param { IPropertySubscriber } subscribeMe
734   * @param { string } info
735   * @syscap SystemCapability.ArkUI.ArkUI.Full
736   * @systemapi
737   * @since 7
738   */
739  constructor(source: SubscribedAbstractProperty<T>, subscribeMe?: IPropertySubscriber, info?: string);
740
741  /**
742   * Called when processing information about to be deleted.
743   *
744   * @param { IPropertySubscriber } unsubscribeMe
745   * @syscap SystemCapability.ArkUI.ArkUI.Full
746   * @systemapi
747   * @since 7
748   */
749  aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void;
750
751  /**
752   * Information Changed.
753   *
754   * @param { T } newValue
755   * @syscap SystemCapability.ArkUI.ArkUI.Full
756   * @systemapi
757   * @since 7
758   */
759  hasChanged(newValue: T): void;
760
761  /**
762   * Called when data is obtained.
763   *
764   * @returns { T }
765   * @syscap SystemCapability.ArkUI.ArkUI.Full
766   * @systemapi
767   * @since 7
768   */
769  get(): T;
770
771  /**
772   * Called when data is created.
773   *
774   * @param { T } newValue
775   * @syscap SystemCapability.ArkUI.ArkUI.Full
776   * @systemapi
777   * @since 7
778   */
779  set(newValue: T): void;
780}
781
782/**
783 * Defines the subscriber.
784 *
785 * @interface ISinglePropertyChangeSubscriber
786 * @syscap SystemCapability.ArkUI.ArkUI.Full
787 * @systemapi
788 * @since 7
789 */
790interface ISinglePropertyChangeSubscriber<T> extends IPropertySubscriber {
791  /**
792   * Provides a single attribute change user interface.
793   *
794   * @param { T } newValue
795   * @syscap SystemCapability.ArkUI.ArkUI.Full
796   * @systemapi
797   * @since 7
798   */
799  hasChanged(newValue: T): void;
800}
801
802/**
803 * Defines the Subscribale base class.
804 *
805 * @syscap SystemCapability.ArkUI.ArkUI.Full
806 * @systemapi
807 * @since 7
808 */
809declare abstract class SubscribaleAbstract {
810  /**
811   * Returns the ownership attribute set by the.
812   *
813   * @syscap SystemCapability.ArkUI.ArkUI.Full
814   * @systemapi
815   * @since 7
816   */
817  private owningProperties_: Set<number>;
818
819  /**
820   * Constructor.
821   *
822   * @syscap SystemCapability.ArkUI.ArkUI.Full
823   * @systemapi
824   * @since 7
825   */
826  constructor();
827
828  /**
829   * Called when the notification property has changed.
830   *
831   * @param { string } propName
832   * @param { any } newValue
833   * @syscap SystemCapability.ArkUI.ArkUI.Full
834   * @systemapi
835   * @since 7
836   */
837  protected notifyPropertyHasChanged(propName: string, newValue: any): void;
838
839  /**
840   * Called when adding an already owned property.
841   *
842   * @param { IPropertySubscriber } subscriber
843   * @syscap SystemCapability.ArkUI.ArkUI.Full
844   * @systemapi
845   * @since 7
846   */
847  public addOwningProperty(subscriber: IPropertySubscriber): void;
848
849  /**
850   * Called when an already owned property is deleted.
851   *
852   * @param { IPropertySubscriber } property
853   * @syscap SystemCapability.ArkUI.ArkUI.Full
854   * @systemapi
855   * @since 7
856   */
857  public removeOwningProperty(property: IPropertySubscriber): void;
858
859  /**
860   * Called when an already owned property is deleted by ID
861   *
862   * @param { number } subscriberId
863   * @syscap SystemCapability.ArkUI.ArkUI.Full
864   * @systemapi
865   * @since 7
866   */
867  public removeOwningPropertyById(subscriberId: number): void;
868}
869
870/**
871 * EnvProps object
872 *
873 * @interface EnvPropsOptions
874 * @syscap SystemCapability.ArkUI.ArkUI.Full
875 * @crossplatform
876 * @since 10
877 */
878declare interface EnvPropsOptions {
879  /**
880   * Property name
881   *
882   * @type { string }
883   * @syscap SystemCapability.ArkUI.ArkUI.Full
884   * @crossplatform
885   * @since 10
886   */
887  key: string;
888
889  /**
890   * DefaultValue is the default value if cannot get the environment property value
891   *
892   * @type { number | string | boolean }
893   * @syscap SystemCapability.ArkUI.ArkUI.Full
894   * @crossplatform
895   * @since 10
896   */
897  defaultValue: number | string | boolean;
898}
899
900/**
901 * Defines the Environment interface.
902 *
903 * @syscap SystemCapability.ArkUI.ArkUI.Full
904 * @since 7
905 */
906/**
907 * Defines the Environment interface.
908 *
909 * @syscap SystemCapability.ArkUI.ArkUI.Full
910 * @crossplatform
911 * @since 10
912 */
913declare class Environment {
914  /**
915   * Constructor.
916   *
917   * @syscap SystemCapability.ArkUI.ArkUI.Full
918   * @systemapi
919   * @since 7
920   */
921  constructor();
922
923  /**
924   * Called when a property value is checked.
925   *
926   * @param { string } key
927   * @param { S } value
928   * @returns { boolean }
929   * @syscap SystemCapability.ArkUI.ArkUI.Full
930   * @since 7
931   * @deprecated since 10
932   * @useinstead Environment#envProp
933   */
934  static EnvProp<S>(key: string, value: S): boolean;
935
936  /**
937   * Creates a new property in AppStorage. The UI framework implementation takes care of updating
938   * its value whenever the named device environment property changes. Recommended use is at app startup.
939   * The function call fails and returns false if a property with given name exists in AppStorage already.
940   * It is wrong API use to access a property with given name in AppStorage before calling Environment.envProp.
941   *
942   * @param { string } key - environment property
943   * @param { S } value - is the default value if cannot get the environment property value
944   * @returns { boolean } false if method failed
945   * @syscap SystemCapability.ArkUI.ArkUI.Full
946   * @crossplatform
947   * @since 10
948   */
949  static envProp<S>(key: string, value: S): boolean;
950
951  /**
952   * Called when multiple property values are checked.
953   *
954   * @param { {key: string;defaultValue: any;}[] } props
955   * @syscap SystemCapability.ArkUI.ArkUI.Full
956   * @since 7
957   * @deprecated since 10
958   * @useinstead Environment#envProps
959   */
960  static EnvProps(
961    props: {
962      key: string;
963      defaultValue: any;
964    }[],
965  ): void;
966
967  /**
968   * Called when multiple property values are checked.
969   *
970   * @param { EnvPropsOptions[] } props
971   * @syscap SystemCapability.ArkUI.ArkUI.Full
972   * @crossplatform
973   * @since 10
974   */
975  static envProps(props: EnvPropsOptions[]): void;
976
977  /**
978   * Set the key value.
979   *
980   * @returns { Array<string> }
981   * @syscap SystemCapability.ArkUI.ArkUI.Full
982   * @since 7
983   * @deprecated since 10
984   * @useinstead Environment#keys
985   */
986  static Keys(): Array<string>;
987
988  /**
989   * returns an Array<string> of all environment property keys
990   *
991   * @returns { Array<string> } all environment property keys
992   * @syscap SystemCapability.ArkUI.ArkUI.Full
993   * @crossplatform
994   * @since 10
995   */
996  static keys(): Array<string>;
997}
998
999/**
1000 * PersistProps object
1001 *
1002 * @interface PersistPropsOptions
1003 * @syscap SystemCapability.ArkUI.ArkUI.Full
1004 * @crossplatform
1005 * @since 10
1006 */
1007declare interface PersistPropsOptions {
1008  /**
1009   * Property name
1010   *
1011   * @type { string }
1012   * @syscap SystemCapability.ArkUI.ArkUI.Full
1013   * @crossplatform
1014   * @since 10
1015   */
1016  key: string;
1017
1018  /**
1019   * If AppStorage does not include this property it will be initialized with this value
1020   *
1021   * @type { number | string | boolean | Object }
1022   * @syscap SystemCapability.ArkUI.ArkUI.Full
1023   * @crossplatform
1024   * @since 10
1025   */
1026  defaultValue: number | string | boolean | Object;
1027}
1028
1029/**
1030 * Defines the PersistentStorage interface.
1031 *
1032 * @syscap SystemCapability.ArkUI.ArkUI.Full
1033 * @since 7
1034 */
1035/**
1036 * Defines the PersistentStorage interface.
1037 *
1038 * @syscap SystemCapability.ArkUI.ArkUI.Full
1039 * @crossplatform
1040 * @since 10
1041 */
1042declare class PersistentStorage {
1043  /**
1044   * Constructor parameters.
1045   *
1046   * @param { AppStorage } appStorage
1047   * @param { Storage } storage
1048   * @syscap SystemCapability.ArkUI.ArkUI.Full
1049   * @systemapi
1050   * @since 7
1051   */
1052  constructor(appStorage: AppStorage, storage: Storage);
1053
1054  /**
1055   * Called when a persistence property is stored.
1056   *
1057   * @param { string } key
1058   * @param { T } defaultValue
1059   * @syscap SystemCapability.ArkUI.ArkUI.Full
1060   * @since 7
1061   * @deprecated since 10
1062   * @useinstead PersistentStorage#persistProp
1063   */
1064  static PersistProp<T>(key: string, defaultValue: T): void;
1065
1066  /**
1067   * Add property 'key' to AppStorage properties whose current value will be
1068   * persistent.
1069   * If AppStorage does not include this property it will be added and initializes
1070   * with given value
1071   *
1072   * @param { string } key - property name
1073   * @param { T } defaultValue - If AppStorage does not include this property it will be initialized with this value
1074   * @syscap SystemCapability.ArkUI.ArkUI.Full
1075   * @crossplatform
1076   * @since 10
1077   */
1078  static persistProp<T>(key: string, defaultValue: T): void;
1079
1080  /**
1081   * Called when a property is deleted.
1082   *
1083   * @param { string } key
1084   * @syscap SystemCapability.ArkUI.ArkUI.Full
1085   * @since 7
1086   * @deprecated since 10
1087   * @useinstead PersistentStorage#deleteProp
1088   */
1089  static DeleteProp(key: string): void;
1090
1091  /**
1092   * Reverse of @see persistProp
1093   *
1094   * @param { string } key - no longer persist the property named key
1095   * @syscap SystemCapability.ArkUI.ArkUI.Full
1096   * @crossplatform
1097   * @since 10
1098   */
1099  static deleteProp(key: string): void;
1100
1101  /**
1102   * Called when multiple persistence properties are stored.
1103   *
1104   * @param { {key: string;defaultValue: any;}[] } properties
1105   * @syscap SystemCapability.ArkUI.ArkUI.Full
1106   * @since 7
1107   * @deprecated since 10
1108   * @useinstead PersistentStorage#PersistProps
1109   */
1110  static PersistProps(
1111    properties: {
1112      key: string;
1113      defaultValue: any;
1114    }[],
1115  ): void;
1116
1117  /**
1118   * Persist given AppStorage properties with given names.
1119   * If a property does not exist in AppStorage, add it and initialize it with given value
1120   * works as @see persistProp for multiple properties.
1121   *
1122   * @param { PersistPropsOptions[] } props
1123   * @syscap SystemCapability.ArkUI.ArkUI.Full
1124   * @crossplatform
1125   * @since 10
1126   */
1127  static persistProps(props: PersistPropsOptions[]): void;
1128
1129  /**
1130   * Set the key value.
1131   *
1132   * @returns { Array<string> }
1133   * @syscap SystemCapability.ArkUI.ArkUI.Full
1134   * @since 7
1135   * @deprecated since 10
1136   * @useinstead PersistentStorage#keys
1137   */
1138  static Keys(): Array<string>;
1139
1140  /**
1141   * Inform persisted AppStorage property names
1142   *
1143   * @returns { Array<string> } array of AppStorage keys
1144   * @syscap SystemCapability.ArkUI.ArkUI.Full
1145   * @crossplatform
1146   * @since 10
1147   */
1148  static keys(): Array<string>;
1149}
1150
1151/**
1152 * Used for ide.
1153 *
1154 * @syscap SystemCapability.ArkUI.ArkUI.Full
1155 * @systemapi
1156 * @since 7
1157 */
1158declare const appStorage: AppStorage;
1159
1160/**
1161 * LocalStorage
1162 * Class implements a Map of ObservableObjectBase UI state variables.
1163 * Instances can be created to manage UI state within a limited "local"
1164 * access, and life cycle as defined by the app.
1165 * AppStorage singleton is sub-class of LocalStorage for
1166 * UI state of app-wide access and same life cycle as the app.
1167 *
1168 * @since 9
1169 * @form
1170 */
1171/**
1172 * LocalStorage
1173 * Class implements a Map of ObservableObjectBase UI state variables.
1174 * Instances can be created to manage UI state within a limited "local"
1175 * access, and life cycle as defined by the app.
1176 * AppStorage singleton is sub-class of LocalStorage for
1177 * UI state of app-wide access and same life cycle as the app.
1178 *
1179 * @crossplatform
1180 * @since 10
1181 * @form
1182 */
1183declare class LocalStorage {
1184  /**
1185   * Construct new instance of LocalStorage
1186   * initialize with all properties and their values that Object.keys(params) returns
1187   * Property values must not be undefined.
1188   *
1189   * @param { Object } [initializingProperties] - Object containing keys and values. see set() for valid values
1190   * @syscap SystemCapability.ArkUI.ArkUI.Full
1191   * @since 9
1192   * @form
1193   */
1194  /**
1195   * Construct new instance of LocalStorage
1196   * initialize with all properties and their values that Object.keys(params) returns
1197   * Property values must not be undefined.
1198   *
1199   * @param { Object } [initializingProperties] - Object containing keys and values. see set() for valid values
1200   * @syscap SystemCapability.ArkUI.ArkUI.Full
1201   * @crossplatform
1202   * @since 10
1203   * @form
1204   */
1205  constructor(initializingProperties?: Object);
1206
1207  /**
1208   * Get current LocalStorage shared from stage.
1209   *
1210   * @returns { LocalStorage }
1211   * @syscap SystemCapability.ArkUI.ArkUI.Full
1212   * @StageModelOnly
1213   * @since 9
1214   * @deprecated since 10
1215   * @useinstead LocalStorage#getShared
1216   * @form
1217   */
1218  static GetShared(): LocalStorage;
1219
1220  /**
1221   * Get current LocalStorage shared from stage.
1222   *
1223   * @returns { LocalStorage } instance
1224   * @syscap SystemCapability.ArkUI.ArkUI.Full
1225   * @StageModelOnly
1226   * @crossplatform
1227   * @since 10
1228   * @form
1229   */
1230  static getShared(): LocalStorage;
1231
1232  /**
1233   * Check if LocalStorage has a property with given name
1234   * return true if property with given name exists
1235   * same as ES6 Map.prototype.has()
1236   *
1237   * @param { string } propName - searched property
1238   * @returns { boolean } true if property with such name exists in LocalStorage
1239   * @syscap SystemCapability.ArkUI.ArkUI.Full
1240   * @since 9
1241   * @form
1242   */
1243  /**
1244   * Check if LocalStorage has a property with given name
1245   * return true if property with given name exists
1246   * same as ES6 Map.prototype.has()
1247   *
1248   * @param { string } propName - searched property
1249   * @returns { boolean } true if property with such name exists in LocalStorage
1250   * @syscap SystemCapability.ArkUI.ArkUI.Full
1251   * @crossplatform
1252   * @since 10
1253   * @form
1254   */
1255  has(propName: string): boolean;
1256
1257  /**
1258   * Provide names of all properties in LocalStorage
1259   * same as ES6 Map.prototype.keys()
1260   *
1261   * @returns { IterableIterator<string> } return a Map Iterator
1262   * @syscap SystemCapability.ArkUI.ArkUI.Full
1263   * @since 9
1264   * @form
1265   */
1266  /**
1267   * Provide names of all properties in LocalStorage
1268   * same as ES6 Map.prototype.keys()
1269   *
1270   * @returns { IterableIterator<string> } return a Map Iterator
1271   * @syscap SystemCapability.ArkUI.ArkUI.Full
1272   * @crossplatform
1273   * @since 10
1274   * @form
1275   */
1276  keys(): IterableIterator<string>;
1277
1278  /**
1279   * Returns number of properties in LocalStorage
1280   * same as Map.prototype.size()
1281   *
1282   * @returns { number } return number of properties
1283   * @syscap SystemCapability.ArkUI.ArkUI.Full
1284   * @since 9
1285   * @form
1286   */
1287  /**
1288   * Returns number of properties in LocalStorage
1289   * same as Map.prototype.size()
1290   *
1291   * @returns { number } return number of properties
1292   * @syscap SystemCapability.ArkUI.ArkUI.Full
1293   * @crossplatform
1294   * @since 10
1295   * @form
1296   */
1297  size(): number;
1298
1299  /**
1300   * Returns value of given property
1301   * return undefined if no property with this name
1302   *
1303   * @param { string } propName
1304   * @returns { T | undefined } property value if found or undefined
1305   * @syscap SystemCapability.ArkUI.ArkUI.Full
1306   * @since 9
1307   * @form
1308   */
1309  /**
1310   * Returns value of given property
1311   * return undefined if no property with this name
1312   *
1313   * @param { string } propName
1314   * @returns { T | undefined } property value if found or undefined
1315   * @syscap SystemCapability.ArkUI.ArkUI.Full
1316   * @crossplatform
1317   * @since 10
1318   * @form
1319   */
1320  get<T>(propName: string): T | undefined;
1321
1322  /**
1323   * Set value of given property in LocalStorage
1324   * Method sets nothing and returns false if property with this name does not exist
1325   * or if newValue is `undefined` or `null` (`undefined`, `null` value are not allowed for state variables).
1326   *
1327   * @param { string } propName
1328   * @param { T } newValue - must be of type T and must not be undefined or null
1329   * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false
1330   * @syscap SystemCapability.ArkUI.ArkUI.Full
1331   * @since 9
1332   * @form
1333   */
1334  /**
1335   * Set value of given property in LocalStorage
1336   * Method sets nothing and returns false if property with this name does not exist
1337   * or if newValue is `undefined` or `null` (`undefined`, `null` value are not allowed for state variables).
1338   *
1339   * @param { string } propName
1340   * @param { T } newValue - must be of type T and must not be undefined or null
1341   * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false
1342   * @syscap SystemCapability.ArkUI.ArkUI.Full
1343   * @crossplatform
1344   * @since 10
1345   * @form
1346   */
1347  set<T>(propName: string, newValue: T): boolean;
1348
1349  /**
1350   * Set value of given property, if it exists, see set() .
1351   * Add property if no property with given name and initialize with given value.
1352   * Do nothing and return false if newValue is undefined or null
1353   * (undefined, null value is not allowed for state variables)
1354   *
1355   * @param { string } propName
1356   * @param { T } newValue - must be of type T and must not be undefined or null
1357   * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false
1358   * @syscap SystemCapability.ArkUI.ArkUI.Full
1359   * @since 9
1360   * @form
1361   */
1362  /**
1363   * Set value of given property, if it exists, see set() .
1364   * Add property if no property with given name and initialize with given value.
1365   * Do nothing and return false if newValue is undefined or null
1366   * (undefined, null value is not allowed for state variables)
1367   *
1368   * @param { string } propName
1369   * @param { T } newValue - must be of type T and must not be undefined or null
1370   * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false
1371   * @syscap SystemCapability.ArkUI.ArkUI.Full
1372   * @crossplatform
1373   * @since 10
1374   * @form
1375   */
1376  setOrCreate<T>(propName: string, newValue: T): boolean;
1377
1378  /**
1379   * Create and return a two-way sync "(link") to named property
1380   *
1381   * @param { string } propName - name of source property in LocalStorage
1382   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
1383   *           return undefined if named property does not already exist in LocalStorage
1384   *           Apps can use SDK functions of base class SubscribedPropertyAbstract<T>
1385   * @syscap SystemCapability.ArkUI.ArkUI.Full
1386   * @since 9
1387   * @form
1388   */
1389  /**
1390   * Create and return a two-way sync "(link") to named property
1391   *
1392   * @param { string } propName - name of source property in LocalStorage
1393   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
1394   *           return undefined if named property does not already exist in LocalStorage
1395   *           Apps can use SDK functions of base class SubscribedPropertyAbstract<T>
1396   * @syscap SystemCapability.ArkUI.ArkUI.Full
1397   * @crossplatform
1398   * @since 10
1399   * @form
1400   */
1401  link<T>(propName: string): SubscribedAbstractProperty<T>;
1402
1403  /**
1404   * Like see link(), but will create and initialize a new source property in LocalStorage if missing
1405   *
1406   * @param { string } propName - name of source property in LocalStorage
1407   * @param { T } defaultValue - value to be used for initializing if new creating new property in LocalStorage
1408   *        default value must be of type T, must not be undefined or null.
1409   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
1410   *          Apps can use SDK functions of base class SubscribedAbstractProperty<T>
1411   * @syscap SystemCapability.ArkUI.ArkUI.Full
1412   * @since 9
1413   * @form
1414   */
1415  /**
1416   * Like see link(), but will create and initialize a new source property in LocalStorage if missing
1417   *
1418   * @param { string } propName - name of source property in LocalStorage
1419   * @param { T } defaultValue - value to be used for initializing if new creating new property in LocalStorage
1420   *        default value must be of type T, must not be undefined or null.
1421   * @returns { SubscribedAbstractProperty<T> } instance of  SubscribedAbstractProperty<T>
1422   *          Apps can use SDK functions of base class SubscribedAbstractProperty<T>
1423   * @syscap SystemCapability.ArkUI.ArkUI.Full
1424   * @crossplatform
1425   * @since 10
1426   * @form
1427   */
1428  setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>;
1429
1430  /**
1431   * Create and return a one-way sync ('prop') to named property
1432   *
1433   * @param { string } propName - name of source property in LocalStorage
1434   * @returns { SubscribedAbstractProperty<S> } instance of  SubscribedAbstractProperty<S>
1435   *           return undefined if named property does not already exist in LocalStorage
1436   *           Apps can use SDK functions of base class SubscribedAbstractProperty<S>
1437   * @syscap SystemCapability.ArkUI.ArkUI.Full
1438   * @since 9
1439   * @form
1440   */
1441  /**
1442   * Create and return a one-way sync ('prop') to named property
1443   *
1444   * @param { string } propName - name of source property in LocalStorage
1445   * @returns { SubscribedAbstractProperty<S> } instance of  SubscribedAbstractProperty<S>
1446   *           return undefined if named property does not already exist in LocalStorage
1447   *           Apps can use SDK functions of base class SubscribedAbstractProperty<S>
1448   * @syscap SystemCapability.ArkUI.ArkUI.Full
1449   * @crossplatform
1450   * @since 10
1451   * @form
1452   */
1453  prop<S>(propName: string): SubscribedAbstractProperty<S>;
1454
1455  /**
1456   * Like see prop(), will create and initialize a new source property in LocalStorage if missing
1457   *
1458   * @param { string } propName - name of source property in LocalStorage
1459   * @param { S } defaultValue - value to be used for initializing if new creating new property in LocalStorage.
1460   *         Default value must be of type T, must not be undefined or null.
1461   * @returns { SubscribedAbstractProperty<S> } instance of  SubscribedAbstractProperty<S>
1462   *           Apps can use SDK functions of base class SubscribedAbstractProperty<S>
1463   * @syscap SystemCapability.ArkUI.ArkUI.Full
1464   * @since 9
1465   * @form
1466   */
1467  /**
1468   * Like see prop(), will create and initialize a new source property in LocalStorage if missing
1469   *
1470   * @param { string } propName - name of source property in LocalStorage
1471   * @param { S } defaultValue - value to be used for initializing if new creating new property in LocalStorage.
1472   *         Default value must be of type T, must not be undefined or null.
1473   * @returns { SubscribedAbstractProperty<S> } instance of  SubscribedAbstractProperty<S>
1474   *           Apps can use SDK functions of base class SubscribedAbstractProperty<S>
1475   * @syscap SystemCapability.ArkUI.ArkUI.Full
1476   * @crossplatform
1477   * @since 10
1478   * @form
1479   */
1480  setAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S>;
1481
1482  /**
1483   * Delete property from StorageBase
1484   * Use with caution:
1485   * Before deleting a prop from LocalStorage all its subscribers need to
1486   * unsubscribe from the property.
1487   * This method fails and returns false if given property still has subscribers
1488   * Another reason for failing is unknown property.
1489   * Developer advise:
1490   * Subscribers are created with see link(), see prop()
1491   * and also via @LocalStorageLink and @LocalStorageProp state variable decorators.
1492   * That means as long as their is a @Component instance that uses such decorated variable
1493   * or a sync relationship with a SubscribedAbstractProperty variable the property can nit
1494   * (and also should not!) be deleted from LocalStorage.
1495   *
1496   * @param { string } propName
1497   * @returns { boolean } false if method failed
1498   * @syscap SystemCapability.ArkUI.ArkUI.Full
1499   * @since 9
1500   * @form
1501   */
1502  /**
1503   * Delete property from StorageBase
1504   * Use with caution:
1505   * Before deleting a prop from LocalStorage all its subscribers need to
1506   * unsubscribe from the property.
1507   * This method fails and returns false if given property still has subscribers
1508   * Another reason for failing is unknown property.
1509   * Developer advise:
1510   * Subscribers are created with see link(), see prop()
1511   * and also via @LocalStorageLink and @LocalStorageProp state variable decorators.
1512   * That means as long as their is a @Component instance that uses such decorated variable
1513   * or a sync relationship with a SubscribedAbstractProperty variable the property can nit
1514   * (and also should not!) be deleted from LocalStorage.
1515   *
1516   * @param { string } propName
1517   * @returns { boolean } false if method failed
1518   * @syscap SystemCapability.ArkUI.ArkUI.Full
1519   * @crossplatform
1520   * @since 10
1521   * @form
1522   */
1523  delete(propName: string): boolean;
1524
1525  /**
1526   * Delete all properties from the LocalStorage instance
1527   * Precondition is that there are no subscribers.
1528   * method returns false and deletes no properties if there is any property
1529   * that still has subscribers
1530   *
1531   * @returns { boolean }
1532   * @syscap SystemCapability.ArkUI.ArkUI.Full
1533   * @since 9
1534   * @form
1535   */
1536  /**
1537   * Delete all properties from the LocalStorage instance
1538   * Precondition is that there are no subscribers.
1539   * method returns false and deletes no properties if there is any property
1540   * that still has subscribers
1541   *
1542   * @returns { boolean }
1543   * @syscap SystemCapability.ArkUI.ArkUI.Full
1544   * @crossplatform
1545   * @since 10
1546   * @form
1547   */
1548  clear(): boolean;
1549}
1550
1551declare module "StateManagement" {
1552  module "StateManagement" {
1553    // @ts-ignore
1554    export { LocalStorage };
1555  }
1556}
1557