2020-03-23 15:45:01 +00:00
|
|
|
import { Component, ViewChild, ElementRef } from '@angular/core';
|
2020-01-27 18:40:18 +00:00
|
|
|
import { IFrameMessageBus } from 'src/iframe-message-bus';
|
2020-03-23 23:35:02 +00:00
|
|
|
import { PriorityAwareMessageBus, MessageBus, Events } from 'protocol';
|
2020-01-27 18:40:18 +00:00
|
|
|
|
|
|
|
|
@Component({
|
2020-02-13 17:03:22 +00:00
|
|
|
templateUrl: './devtools-app.component.html',
|
|
|
|
|
styleUrls: ['./devtools-app.component.css'],
|
2020-03-18 00:48:29 +00:00
|
|
|
providers: [
|
|
|
|
|
{
|
|
|
|
|
provide: MessageBus,
|
|
|
|
|
useFactory(): MessageBus<Events> {
|
2020-03-23 23:35:02 +00:00
|
|
|
return new PriorityAwareMessageBus(
|
|
|
|
|
new IFrameMessageBus(
|
|
|
|
|
'angular-devtools',
|
|
|
|
|
'angular-devtools-backend',
|
|
|
|
|
// tslint:disable-next-line: no-non-null-assertion
|
|
|
|
|
() => (document.querySelector('#sample-app') as HTMLIFrameElement).contentWindow!
|
|
|
|
|
)
|
|
|
|
|
);
|
2020-03-18 00:48:29 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2020-01-27 18:40:18 +00:00
|
|
|
})
|
2020-03-18 00:48:29 +00:00
|
|
|
export class DevToolsComponent {
|
2020-01-27 18:40:18 +00:00
|
|
|
messageBus: IFrameMessageBus | null = null;
|
|
|
|
|
@ViewChild('ref') iframe: ElementRef;
|
|
|
|
|
}
|