Add onTimeZoneChange event |
|||||
Issue descriptionThis is a feature request. See https://github.com/whatwg/html/pull/3047 . When there's a change in timezone, it'd be very useful to fire an event so that web apps (such as calendar, web-based mail, numerous others that need to show date/time ) can update the date/time displayed by listening to it. Currently, either users have to reload web pages after a timezone change or web apps have to poll on a regular basis to detect a timezone change. Blink>DOM may not be a good choice, but I'm not sure of any other component (other than 'Blink). Other event APIs are dealt with in Blink>Input, Blink>GamePad (event specific components).
,
Nov 26
BTW, Blink does have a timezone monitor to detect the timezone change in the OS. When a timezone change is detected, it's sent down to v8 engine and its timezone is updated.
,
Nov 26
bug 365123 is about languagechange event. https://www.chromestatus.com/features/6056371904577536 bug 276159 is about languagechange event in worker.
,
Nov 26
The proposal is to add it to worker as well.
,
Nov 26
I think the following code used to hook up with the v8::Date::DateTimeConfigurationChangeNotification is related https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/time_zone_monitor/time_zone_monitor_client.cc?q=DateTimeConfigurationChangeNotification&dr=C void NotifyTimezoneChangeToV8(v8::Isolate* isolate) { DCHECK(isolate); v8::Date::DateTimeConfigurationChangeNotification(isolate); } void NotifyTimezoneChangeOnWorkerThread(WorkerThread* worker_thread) { DCHECK(worker_thread->IsCurrentThread()); NotifyTimezoneChangeToV8(ToIsolate(worker_thread->GlobalScope())); }
,
Nov 26
My guess is it require the change to the following files:
src/third_party/blink/renderer/core/frame/window_event_handlers.h
to add a
DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(timezonechange, kTimezonechange);
src/third_party/blink/renderer/core/frame/local_dom_window.h
add TimeZoneChanged
src/third_party/blink/renderer/core/frame/local_dom_window.cc
add
void LocalDOMWindow::TimeZoneChanged() {
DispatchEvent(*Event::Create(event_type_names::kTimezonechange));
}
,
Nov 26
also src/services/device/time_zone_monitor/time_zone_monitor.cc void TimeZoneMonitor::NotifyClients()
,
Nov 26
cc leon.han@intel.com & watk@chromium.org since they used to work on timezone related monitoring.
,
Nov 26
Probably a better way to following is orientationchange since both orientation and timzone are bind in https://cs.chromium.org/chromium/src/services/device/device_service.h and event fired in window level
,
Nov 26
Yeah... orientationchange seems to be a better model for timezone change. It's fixed in bug 162827 .
,
Nov 30
,
Dec 17
,
Dec 17
Let's make sure we have a strong resolution to https://github.com/whatwg/html/pull/3047#issuecomment-434257234 before shipping this change. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by js...@chromium.org
, Nov 26