mirror of
https://gitee.com/openharmony/applications_screenlock
synced 2024-11-23 06:19:47 +00:00
datetime and commonEvent problem
Signed-off-by: zhuchengfeng <940848916@qq.com>
This commit is contained in:
parent
ec8944a7b3
commit
e4ff5dbf8a
@ -49,14 +49,14 @@ export default class DateTimeViewModel {
|
||||
this.setDateTime.bind(this)()
|
||||
commonEvent.createSubscriber(mCommonEventSubscribeInfo, this.createSubscriberCallBack.bind(this));
|
||||
this.unSubscriber = EventManager.subscribe(TIME_CHANGE_EVENT, (args: TimeEventArgs) => {
|
||||
this.setDateTime(args.date)
|
||||
this.setDateTime()
|
||||
});
|
||||
Log.showInfo(TAG, 'ViewModelInit end');
|
||||
}
|
||||
|
||||
private setDateTime(date?: Date) {
|
||||
private setDateTime() {
|
||||
Log.showInfo(TAG, `setDateTime`)
|
||||
this.timeVal = sTimeManager.formatTime(date ?? new Date())
|
||||
this.timeVal = sTimeManager.formatTime(new Date())
|
||||
this.dateVal = DateTimeCommon.getSystemDate()
|
||||
this.weekVal = DateTimeCommon.getSystemWeek()
|
||||
}
|
||||
|
@ -312,9 +312,10 @@ export class ScreenLockService {
|
||||
})
|
||||
}
|
||||
|
||||
private publish(eventName:string) {
|
||||
private publish(eventName: string) {
|
||||
Log.showInfo(TAG, `publish event name: ${eventName}`)
|
||||
commonEvent.publish(eventName, (error, value) => {
|
||||
if (error != null) {
|
||||
if (error.code) {
|
||||
Log.showError(TAG, 'Operation failed. Cause: ' + JSON.stringify(error));
|
||||
} else {
|
||||
Log.showInfo(TAG, 'publish common event success. ' + JSON.stringify(value));
|
||||
|
Loading…
Reference in New Issue
Block a user