File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,23 @@ function formatDisplay(display: string) {
1515 }
1616}
1717
18+ function toastMessage (
19+ message : string ,
20+ type ?: 'normal' | 'error' | 'warning' | undefined
21+ ) {
22+ const piniaMessage = '🍍 ' + message
23+
24+ if ( typeof __VUE_DEVTOOLS_TOAST__ === 'function' ) {
25+ __VUE_DEVTOOLS_TOAST__ ( piniaMessage , type )
26+ } else if ( type === 'error' ) {
27+ console . error ( piniaMessage )
28+ } else if ( type === 'warning' ) {
29+ console . warn ( piniaMessage )
30+ } else {
31+ console . log ( piniaMessage )
32+ }
33+ }
34+
1835let isAlreadyInstalled : boolean | undefined
1936
2037export function addDevtools ( app : App , store : GenericStore ) {
@@ -116,18 +133,15 @@ export function addDevtools(app: App, store: GenericStore) {
116133 options : formatStoreForInspectorState ( store ) ,
117134 }
118135 } else {
119- __VUE_DEVTOOLS_TOAST__ (
120- `🍍 store "${ payload . nodeId } " not found` ,
121- 'error'
122- )
136+ toastMessage ( `store "${ payload . nodeId } " not found` , 'error' )
123137 }
124138 }
125139 } )
126140
127141 // trigger an update so it can display new registered stores
128142 // @ts -ignore
129143 api . notifyComponentUpdate ( )
130- __VUE_DEVTOOLS_TOAST__ ( `🍍 "${ store . $id } " store installed`)
144+ toastMessage ( ` "${ store . $id } " store installed`)
131145 }
132146 )
133147}
You can’t perform that action at this time.
0 commit comments