You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
unset: The badge from a parent scope will be applied (or none, if there is no badge for a parent scope).
cleared: No badge is displayed for the scope.
flag: A special value indicating a notification dot should be displayed.
<number> A non-zero, positive number: The value will be displayed in the badge.
If badge is undefined or not present then the badge for the scope is unset
If badge is a boolean false sets the badge to cleared while true sets it to flag.
If badge is a number 0 sets the badge to cleared while other positive numbers set the badge to that number.
Alternatively, we could introduce separate methods for each value, as in #19.
// 0 sets the badge to cleared, other values set the badge to that value.Badge.setNumber(<number>, {scope: '...'});
// false sets the badge to cleared, true sets the badge to flag.
Badge.setFlag(boolean, {scope: '...'});
// Unsets the badge.
Badge.unset({scope: '...'});
I think this second approach is more friendly for polyfilling (though both should be polyfillable) if we add a new type (such as glyphs). However, in the second approach, it's less obvious that there is only one badge value active at any time.
@raymeskhoury floated that we stick with the current Badge.clear({ scope: '...' }) design and add an optional extra noInherit property if we decide we need it in the future.
Resolution on this was that we would start with just unset and (possibly) add a separate cleared value in future, if it seemed like it would be useful. However, with the changes proposed in #55 this will no longer be needed.
This is semi related to #19.
What the behavior of
Badge.clear({ scope: '...' })
should be is a little unclear.Is the badge for that specific scope now
clear
or does it display the badge from a parent scope?Perhaps we should remove separate
set/clear
methods in favor of something like this:A badge for a scope can be in one of four states:
unset
: The badge from a parent scope will be applied (or none, if there is no badge for a parent scope).cleared
: No badge is displayed for the scope.flag
: A special value indicating a notification dot should be displayed.<number>
A non-zero, positive number: The value will be displayed in the badge.If
badge
is undefined or not present then the badge for the scope isunset
If
badge
is a boolean false sets the badge tocleared
while true sets it toflag
.If
badge
is a number0
sets the badge tocleared
while other positive numbers set the badge to that number.Alternatively, we could introduce separate methods for each value, as in #19.
I think this second approach is more friendly for polyfilling (though both should be polyfillable) if we add a new type (such as glyphs). However, in the second approach, it's less obvious that there is only one badge value active at any time.
@domenic I know you had some thoughts on this.
@marcoscaceres @mgiuca @raymeskhoury
The text was updated successfully, but these errors were encountered: