Skip to content

Commit db366f2

Browse files
committed
Display a different badge color when dev version found.
1 parent cd5b8ba commit db366f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

devtools/background.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ chrome.runtime.onMessage.addListener( ( message, sender, sendResponse ) => {
5959
// If three.js is detected, show a badge
6060
if ( message.name === 'register' && message.detail && message.detail.revision ) {
6161

62-
const revision = String( parseInt( message.detail.revision, 10 ) );
62+
const revision = String( message.detail.revision );
63+
const number = revision.replace( /\D+$/, '' );
64+
const isDev = revision.includes( 'dev' );
6365

64-
chrome.action.setBadgeText( { tabId: tabId, text: revision } ).catch( () => { /* Tab might be gone */ } );
66+
chrome.action.setBadgeText( { tabId: tabId, text: number } ).catch( () => { /* Tab might be gone */ } );
6567
chrome.action.setBadgeTextColor( { tabId: tabId, color: '#ffffff' } ).catch( () => { /* Tab might be gone */ } );
66-
chrome.action.setBadgeBackgroundColor( { tabId: tabId, color: '#049ef4' } ).catch( () => { /* Tab might be gone */ } );
68+
chrome.action.setBadgeBackgroundColor( { tabId: tabId, color: isDev ? '#ff0098' : '#049ef4' } ).catch( () => { /* Tab might be gone */ } );
6769

6870
}
6971

0 commit comments

Comments
 (0)