generated from custom-cards/boilerplate-card
-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Change media fetches to be asynchronous to view render (#1702)
This is a fairly non-trivial change in terms of consequence, so a greater than average chance something breaks. This is necessary since some cameras (e.g. Reolink) are materially slower to fetch media, and this change substantially improves card responsiveness.
- Loading branch information
1 parent
c69fdff
commit 9ac6134
Showing
23 changed files
with
1,480 additions
and
820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { View } from '../../../view/view'; | ||
import { ViewModifier } from '../types'; | ||
|
||
export const applyViewModifiers = ( | ||
view: View, | ||
modifiers?: ViewModifier[] | null, | ||
): void => { | ||
modifiers?.forEach((modifier) => modifier.modify(view)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { MediaQueries } from '../../../view/media-queries'; | ||
import { MediaQueriesResults } from '../../../view/media-queries-results'; | ||
import { View } from '../../../view/view'; | ||
import { ViewModifier } from '../types'; | ||
|
||
export class SetQueryViewModifier implements ViewModifier { | ||
protected _query?: MediaQueries | null; | ||
protected _queryResults?: MediaQueriesResults | null; | ||
|
||
constructor(options?: { | ||
query?: MediaQueries | null; | ||
queryResults?: MediaQueriesResults | null; | ||
}) { | ||
this._query = options?.query; | ||
this._queryResults = options?.queryResults; | ||
} | ||
|
||
public modify(view: View): void { | ||
if (this._query !== undefined) { | ||
view.query = this._query; | ||
} | ||
if (this._queryResults !== undefined) { | ||
view.queryResults = this._queryResults; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.