mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 03:22:11 +00:00
Cache callback functions
This commit is contained in:
parent
15d325e571
commit
6c07ebe992
1 changed files with 4 additions and 4 deletions
|
|
@ -13,18 +13,18 @@ const SectionsList = React.forwardRef(({ className, sections, preferences, onPre
|
||||||
onPreferenceChanged(id, color);
|
onPreferenceChanged(id, color);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDropdown = (event) => {
|
const updateDropdown = React.useCallback((event) => {
|
||||||
var data = event.currentTarget.dataset;
|
var data = event.currentTarget.dataset;
|
||||||
onPreferenceChanged(data.name, data.value);
|
onPreferenceChanged(data.name, data.value);
|
||||||
};
|
});
|
||||||
|
|
||||||
const checkUser = (event) => {
|
const checkUser = React.useCallback((event) => {
|
||||||
if(! preferences.user) {
|
if(! preferences.user) {
|
||||||
// Here in Stremio 4 we show a toast with a message, asking the anonymous user to log in/register
|
// Here in Stremio 4 we show a toast with a message, asking the anonymous user to log in/register
|
||||||
console.log('No user found');
|
console.log('No user found');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Determines whether the link should be opened in new window or in the current one.
|
// Determines whether the link should be opened in new window or in the current one.
|
||||||
const getTargetFor = url => ['//', 'http://', 'https://', 'file://', 'ftp://', 'mailto:', 'magnet:']
|
const getTargetFor = url => ['//', 'http://', 'https://', 'file://', 'ftp://', 'mailto:', 'magnet:']
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue