New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Your turn favicon badge #461
Comments
Love the idea! |
The library you linked to hasn't been maintained for some years now though. We can probably get good mileage by just changing the page title to something like: |
Yea I realised that - will look around to see what we can do. |
Another option to explore would be the Web Notifications API, although this should probably be an opt-in feature because the UI is more intrusive. Both this and the title prefix should probably be opt-in (the user needs to set a boolean on the |
I think the badge would still be nice compared to title change (for pinned chrome tabs). Also, how do you think we should implement this? Something will need to change on |
I wonder if this could be developed as a plug-in? It seems like a good candidate for something that users could add optionally rather than an essential part of core. (If there are technical reasons he current plug-in interface can’t support this, it would also be an opportunity to look at improving that.) |
The plugin interface is mostly concerned with game logic and the general API of the framework. I don't think plugins should be involved here. However, I'm definitely supportive of the idea that users that don't want this feature should not incur a cost. It's easy enough to turn it on / off via a boolean prop in However, what about bundle size cost? If we're pulling in an additional dep, we should make it possible to not include it in the bundle if users don't want it. |
Yes — I was just coming to that realisation too. I wonder if it could be a hook that you don’t need to import if you’re not using it? For example, maybe Then you could do: import NotificationPlugin from 'package'
<Client
plugins={[
NotificationPlugin,
// ...
]}
/> We’d need to figure out exactly how to implement the interface within At the simplest a plugin could be a function that takes an object with all the state variables or something: const Plugin = ({ ctx, playerID }) => {
useEffect(() => {
// update badge
}, [ctx.turn])
} |
We used to use https://www.npmjs.com/package/react-json-view to render Some of the material here might be relevant: https://reactjs.org/docs/code-splitting.html However, we are moving everything to Svelte (#432), so ideally we'd implement something that doesn't have to be rewritten drastically. |
What if this kind of functionality could be shipped as plug-ins to the vanilla JS client? (Rather than tying it to the React Notifications in general — in |
That's exactly what the Svelte migration is trying to achieve (make a lot of this type of code available to the vanilla JS client). Svelte just compiles down to plain JS that can be included with the vanilla JS client. We could also write some plain JS to implement the present feature being discussed (i.e. it doesn't have to wait for the Svelte migration necessarily). We don't currently have a good mechanism to tap into events like |
When it's a player's turn, update favicon with badge using https://github.com/ejci/favico.js.
This helps the user to play long-running board games while doing other things by notifying them it's their turn.
The text was updated successfully, but these errors were encountered: