File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export class SpruceProxy {
1313
1414 constructor ( window : any = null , rayInstance : any = null ) {
1515 this . window = window ?? getWindow ( ) ;
16- this . rayInstance = rayInstance ?? ray ;
16+ this . rayInstance = rayInstance ?? ray ( ) ;
1717 this . spruceInstance = this . window . Spruce ;
1818 }
1919
@@ -73,7 +73,7 @@ export class SpruceProxy {
7373
7474 public displayTracking ( key : string , action : string , value : any ) {
7575 if ( typeof trackRays [ < string > key ] === 'undefined' ) {
76- trackRays [ < string > key ] = this . rayInstance ( ) ;
76+ trackRays [ < string > key ] = this ? .rayInstance ( ) ?? ray ( ) ;
7777 }
7878
7979 const data = {
@@ -88,10 +88,12 @@ export class SpruceProxy {
8888 }
8989
9090 public dumpStore ( name : string ) {
91- this . rayInstance ( ) . table ( this . spruceInstance . stores [ name ] ) ;
91+ const rayInstance = this ?. rayInstance ?? ray ;
92+ rayInstance ( ) . table ( this . spruceInstance . stores [ name ] ) ;
9293 }
9394
9495 public dumpAllStores ( ) {
95- this . rayInstance ( ) . table ( this . spruceInstance . stores ) ;
96+ const rayInstance = this ?. rayInstance ?? ray ;
97+ rayInstance ( ) . table ( this . spruceInstance . stores ) ;
9698 }
9799}
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ import { getWindow } from './lib/utils';
55
66export { bootstrapImports } from './BootstrapImports' ;
77
8- initializeLibrary ( [ AlpineRayPlugin ] , getWindow ( ) , ray ( ) ) ;
8+ initializeLibrary ( [ AlpineRayPlugin ] , getWindow ( ) , ray ) ;
99
1010export default AlpineRayPlugin ;
Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ class FakeRay {
4646
4747beforeEach ( ( ) => {
4848 win = {
49+ ray ( ...args : any [ ] ) {
50+ if ( ! args . length ) {
51+ return new FakeRay ( ) ;
52+ }
53+ return new FakeRay ( ) . send ( 'log' , ...args ) ;
54+ } ,
4955 axios : { } ,
5056 alpineRayConfig : {
5157 logComponentsInit : false ,
You can’t perform that action at this time.
0 commit comments