From f9792ae3d8e1dbd7daad4a73ea23f36d2078682f Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 30 Apr 2018 08:29:04 -0700 Subject: [PATCH] remove deprecated .observe() from components (#246) --- routes/_components/Toast.html | 3 ++- routes/_components/compose/ComposeAutosuggest.html | 2 ++ routes/_components/compose/ComposeBox.html | 2 ++ routes/_components/compose/ComposeContentWarning.html | 2 ++ routes/_components/compose/ComposeInput.html | 2 ++ routes/_components/compose/ComposeLengthGauge.html | 4 ++++ routes/_components/compose/ComposeLengthIndicator.html | 4 ++++ routes/_components/compose/ComposeMediaItem.html | 2 ++ routes/_components/pseudoVirtualList/PseudoVirtualList.html | 2 ++ .../_components/pseudoVirtualList/PseudoVirtualListItem.html | 4 ++++ routes/_components/status/StatusComposeBox.html | 2 ++ routes/_components/timeline/Timeline.html | 2 ++ routes/_components/virtualList/VirtualList.html | 2 ++ routes/_components/virtualList/VirtualListContainer.html | 2 ++ routes/_components/virtualList/VirtualListHeader.html | 2 ++ 15 files changed, 36 insertions(+), 1 deletion(-) diff --git a/routes/_components/Toast.html b/routes/_components/Toast.html index 8507740..7d49022 100644 --- a/routes/_components/Toast.html +++ b/routes/_components/Toast.html @@ -44,7 +44,7 @@ } \ No newline at end of file diff --git a/routes/_components/compose/ComposeLengthIndicator.html b/routes/_components/compose/ComposeLengthIndicator.html index f4e4c4a..6f5e6c7 100644 --- a/routes/_components/compose/ComposeLengthIndicator.html +++ b/routes/_components/compose/ComposeLengthIndicator.html @@ -20,6 +20,7 @@ import { mark, stop } from '../../_utils/marks' import { store } from '../../_store/store' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' + import { observe } from 'svelte-extras' export default { oncreate () { @@ -48,6 +49,9 @@ return `${lengthToDisplayDeferred} characters remaining` } } + }, + methods: { + observe } } \ No newline at end of file diff --git a/routes/_components/compose/ComposeMediaItem.html b/routes/_components/compose/ComposeMediaItem.html index 7765217..898d7c7 100644 --- a/routes/_components/compose/ComposeMediaItem.html +++ b/routes/_components/compose/ComposeMediaItem.html @@ -79,6 +79,7 @@ import { deleteMedia } from '../../_actions/media' import debounce from 'lodash-es/debounce' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' + import { observe } from 'svelte-extras' export default { oncreate () { @@ -90,6 +91,7 @@ }), store: () => store, methods: { + observe, setupSyncFromStore () { this.observe('mediaDescriptions', mediaDescriptions => { mediaDescriptions = mediaDescriptions || [] diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualList.html b/routes/_components/pseudoVirtualList/PseudoVirtualList.html index 47e710c..f8df7e2 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualList.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualList.html @@ -23,6 +23,7 @@ import { getRectFromEntry } from '../../_utils/getRectFromEntry' import { mark, stop } from '../../_utils/marks' import { pseudoVirtualListStore } from './pseudoVirtualListStore' + import { observe } from 'svelte-extras' export default { oncreate () { @@ -75,6 +76,7 @@ } }, methods: { + observe, scrollToPosition (element) { let { scrolledToPosition } = this.get() if (scrolledToPosition) { diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html b/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html index 63dc61f..209cfc6 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualListItem.html @@ -14,6 +14,7 @@ diff --git a/routes/_components/status/StatusComposeBox.html b/routes/_components/status/StatusComposeBox.html index c86c283..056a993 100644 --- a/routes/_components/status/StatusComposeBox.html +++ b/routes/_components/status/StatusComposeBox.html @@ -20,6 +20,7 @@ import debounce from 'lodash-es/debounce' import throttle from 'lodash-es/throttle' import { on } from '../../_utils/eventBus' + import { observe } from 'svelte-extras' const DEBOUNCE_DELAY = 400 const THROTTLE_DELAY = 150 @@ -34,6 +35,7 @@ composeData: ($currentComposeData, originalStatusId) => $currentComposeData[originalStatusId] || {} }, methods: { + observe, onPostedStatus (realm) { let { originalStatusId } = this.get() if (realm !== originalStatusId) { diff --git a/routes/_components/timeline/Timeline.html b/routes/_components/timeline/Timeline.html index 545c987..ea1193c 100644 --- a/routes/_components/timeline/Timeline.html +++ b/routes/_components/timeline/Timeline.html @@ -57,6 +57,7 @@ import { mark, stop } from '../../_utils/marks' import isEqual from 'lodash-es/isEqual' import { doubleRAF } from '../../_utils/doubleRAF' + import { observe } from 'svelte-extras' export default { oncreate () { @@ -150,6 +151,7 @@ blurWithCapture }, methods: { + observe, initialize () { let { initializeStarted } = this.get() if (initializeStarted) { diff --git a/routes/_components/virtualList/VirtualList.html b/routes/_components/virtualList/VirtualList.html index 4ea2d3e..60153fc 100644 --- a/routes/_components/virtualList/VirtualList.html +++ b/routes/_components/virtualList/VirtualList.html @@ -32,6 +32,7 @@ import throttle from 'lodash-es/throttle' import { mark, stop } from '../../_utils/marks' import isEqual from 'lodash-es/isEqual' + import { observe } from 'svelte-extras' const DISTANCE_FROM_BOTTOM_TO_FIRE = 800 const SCROLL_EVENT_THROTTLE = 1000 @@ -108,6 +109,7 @@ allVisibleItemsHaveHeight: ($allVisibleItemsHaveHeight) => $allVisibleItemsHaveHeight }, methods: { + observe, calculateListOffset () { // TODO: better way to get the offset top? let node = this.refs.node diff --git a/routes/_components/virtualList/VirtualListContainer.html b/routes/_components/virtualList/VirtualListContainer.html index 3d64ca7..daf10b6 100644 --- a/routes/_components/virtualList/VirtualListContainer.html +++ b/routes/_components/virtualList/VirtualListContainer.html @@ -7,6 +7,7 @@ import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { isMobile } from '../../_utils/isMobile' import { doubleRAF } from '../../_utils/doubleRAF' + import { observe } from 'svelte-extras' const SCROLL_EVENT_DELAY = 300 @@ -60,6 +61,7 @@ }, store: () => virtualListStore, methods: { + observe, setupScroll (node) { if (!node) { return diff --git a/routes/_components/virtualList/VirtualListHeader.html b/routes/_components/virtualList/VirtualListHeader.html index baecc2b..3c726a7 100644 --- a/routes/_components/virtualList/VirtualListHeader.html +++ b/routes/_components/virtualList/VirtualListHeader.html @@ -24,6 +24,7 @@ import { virtualListStore } from './virtualListStore' import { doubleRAF } from '../../_utils/doubleRAF' import { mark, stop } from '../../_utils/marks' + import { observe } from 'svelte-extras' export default { oncreate () { @@ -41,6 +42,7 @@ }), store: () => virtualListStore, methods: { + observe, doCalculateHeight () { let { heightCalculated } = this.get() if (heightCalculated) { // only need to calculate once, it never changes