maykar / lovelace-swipe-navigation

↔️ Swipe through Lovelace views on mobile.
MIT License
205 stars 71 forks source link

Fix behavior when not on lovelace and loaded #31

Closed KTibow closed 4 years ago

KTibow commented 4 years ago

This fixes the behavior of it when it gets loaded, and Lovelace isn't open. It closes #21.

maykar commented 4 years ago

Thanks for this! Though I would rather this use a mutation observer than a timeout.

I did a quick look, but just in case: is there anything else that was changed besides moving into a function with the hui-root timeout?

KTibow commented 4 years ago

No, I un-indented it and put it through another differ: https://www.diffchecker.com/Ro9tRE3E I looked through some mutation observer docs to see what it is. Do you have any reccomendations for how to configure it, because I'm kind of new?

maykar commented 4 years ago

No worries, I'll work on it as soon as I can. I'm currently taking some time away in a cabin with poor internet, but will mess with it soon.

If you wanted to take a crack at it or just check out some uses of mutation observers working with Lovelace elements, I use them quite a bit in Custom Header ( in the custom-header.ts, in observers.js, and in menu-observers.js ).

maykar commented 4 years ago

Updated to trigger when a new dashboard is loaded, kept your timeout for hui-root. Wanted to post these changes before I lint the file so they're easier to see. Next commit will just be linting/formatting.

maykar commented 4 years ago

Going to pull this, but I'm going to try to address one or two of the other issues before actual release

KTibow commented 4 years ago

FYI spelling: swipeNavigaiton swipeNavigation (it > ti)

maykar commented 4 years ago

Had another typo elsewhere so this is fixed in the most recent release as well, thanks.