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 16/** 17 * Provides a way to control the textclock status. 18 * @since 8 19 */ 20declare class TextClockController { 21 /** 22 * constructor. 23 * @since 8 24 */ 25 constructor(); 26 /** 27 * Provides a start event for textclock. 28 * @since 8 29 */ 30 start(); 31 /** 32 * Provides a stop event for textclock. 33 * @since 8 34 */ 35 stop(); 36} 37 38/** 39 * TextClock component, which provides the text clock capability. 40 * @since 8 41 */ 42interface TextClockInterface { 43 /** 44 * Construct the text clock component. 45 * Specifies the current time zone. 46 * The valid value is an integer ranging from - 14 to 12, 47 * Where a negative value indicates the eastern time zone, for example, -8. 48 * @since 8 49 */ 50 (options?: { timeZoneOffset?: number; controller?: TextClockController }): TextClockAttribute; 51} 52 53declare class TextClockAttribute extends CommonMethod<TextClockAttribute> { 54 /** 55 * set display time format,such as "yyyy/mm/dd","yyyy-mm-dd". 56 * support time format:yyyy,mm,mmm(English month abbreviation),mmmm(Full name of the month in English), 57 * dd,ddd(English Week abbreviation),dddd(Full name of the week in English), 58 * HH/hh(24-hour clock/12-hour clock),MM/mm(minute),SS/ss(second). 59 * @since 8 60 */ 61 format(value: string): TextClockAttribute; 62 /** 63 * Provides a date change callback. 64 * The callback parameter is Unix Time Stamp, 65 * The number of milliseconds that have elapsed since January 1, 1970 (UTC). 66 * The minimum callback interval for this event is seconds. 67 * You can listen to this callback, 68 * Use the format attribute method to customize data display in the callback. 69 * @param event Listening date event callback. 70 * @since 8 71 */ 72 onDateChange(event: (value: number) => void): TextClockAttribute; 73 /** 74 * Called when the value of TextClock fontColor is set 75 * @since 8 76 */ 77 fontColor(value: ResourceColor): TextClockAttribute; 78 /** 79 * Called when the value of TextClock fontSize is set 80 * @since 8 81 */ 82 fontSize(value: Length): TextClockAttribute; 83 /** 84 * Called when the value of TextClock fontStyle is set 85 * @since 8 86 */ 87 fontStyle(value: FontStyle): TextClockAttribute; 88 /** 89 * Called when the value of TextClock fontWeight is set 90 * @since 8 91 */ 92 fontWeight(value: number | FontWeight | string): TextClockAttribute; 93 /** 94 * Called when the value of TextClock fontFamily is set 95 * @since 8 96 */ 97 fontFamily(value: ResourceStr): TextClockAttribute; 98} 99 100/** 101 * Defines TextClock Component. 102 * @since 8 103 */ 104declare const TextClock: TextClockInterface; 105 106/** 107 * Defines TextClock Component instance. 108 * @since 8 109 */ 110declare const TextClockInstance: TextClockAttribute; 111