return getPublicInstance(i.parent)
}
-export const publicPropertiesMap: PublicPropertiesMap = /*#__PURE__*/ extend(
- Object.create(null),
- {
+export const publicPropertiesMap: PublicPropertiesMap =
+ // Move PURE marker to new line to workaround compiler discarding it
+ // due to type annotation
+ /*#__PURE__*/ extend(Object.create(null), {
$: i => i,
$el: i => i.vnode.el,
$data: i => i.data,
$forceUpdate: i => () => queueJob(i.update),
$nextTick: i => nextTick.bind(i.proxy!),
$watch: i => (__FEATURE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
- } as PublicPropertiesMap
-)
+ } as PublicPropertiesMap)
if (__COMPAT__) {
installCompatInstanceProperties(publicPropertiesMap)
) {
if (descriptor.get != null) {
// invalidate key cache of a getter based property #5417
- target.$.accessCache[key] = 0;
- } else if (hasOwn(descriptor,'value')) {
+ target.$.accessCache[key] = 0
+ } else if (hasOwn(descriptor, 'value')) {
this.set!(target, key, descriptor.value, null)
}
return Reflect.defineProperty(target, key, descriptor)
type EventValue = Function | Function[]
// Async edge case fix requires storing an event listener's attach timestamp.
-let _getNow: () => number = Date.now
-
-let skipTimestampCheck = false
-
-if (typeof window !== 'undefined') {
- // Determine what event timestamp the browser is using. Annoyingly, the
- // timestamp can either be hi-res (relative to page load) or low-res
- // (relative to UNIX epoch), so in order to compare time we have to use the
- // same timestamp type when saving the flush timestamp.
- if (_getNow() > document.createEvent('Event').timeStamp) {
- // if the low-res timestamp which is bigger than the event timestamp
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
- // and we need to use the hi-res version for event listeners as well.
- _getNow = () => performance.now()
+const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
+ let _getNow = Date.now
+ let skipTimestampCheck = false
+ if (typeof window !== 'undefined') {
+ // Determine what event timestamp the browser is using. Annoyingly, the
+ // timestamp can either be hi-res (relative to page load) or low-res
+ // (relative to UNIX epoch), so in order to compare time we have to use the
+ // same timestamp type when saving the flush timestamp.
+ if (Date.now() > document.createEvent('Event').timeStamp) {
+ // if the low-res timestamp which is bigger than the event timestamp
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
+ // and we need to use the hi-res version for event listeners as well.
+ _getNow = () => performance.now()
+ }
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
+ // and does not fire microtasks in between event propagation, so safe to exclude.
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i)
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53)
}
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
- // and does not fire microtasks in between event propagation, so safe to exclude.
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i)
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53)
-}
+ return [_getNow, skipTimestampCheck]
+})()
// To avoid the overhead of repeatedly calling performance.now(), we cache
// and use the same timestamp for all event listeners attached in the same tick.
let cachedNow: number = 0
-const p = Promise.resolve()
+const p = /*#__PURE__*/ Promise.resolve()
const reset = () => {
cachedNow = 0
}