2021-12-09 05:44:17 +00:00
|
|
|
import {Component, ElementRef, ViewChild} from '@angular/core';
|
|
|
|
|
import {Events, MessageBus, PriorityAwareMessageBus} from 'protocol';
|
|
|
|
|
|
|
|
|
|
import {IFrameMessageBus} from '../../iframe-message-bus';
|
2020-01-27 18:40:18 +00:00
|
|
|
|
|
|
|
|
@Component({
|
2020-02-13 17:03:22 +00:00
|
|
|
templateUrl: './devtools-app.component.html',
|
2020-03-29 03:28:36 +00:00
|
|
|
styleUrls: ['./devtools-app.component.scss'],
|
2020-03-18 00:48:29 +00:00
|
|
|
providers: [
|
|
|
|
|
{
|
|
|
|
|
provide: MessageBus,
|
|
|
|
|
useFactory(): MessageBus<Events> {
|
2021-12-09 05:44:17 +00:00
|
|
|
return new PriorityAwareMessageBus(new IFrameMessageBus(
|
|
|
|
|
'angular-devtools', 'angular-devtools-backend',
|
2020-03-23 23:35:02 +00:00
|
|
|
// tslint:disable-next-line: no-non-null-assertion
|
2021-12-09 05:44:17 +00:00
|
|
|
() => (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 {
|
2021-12-09 05:44:17 +00:00
|
|
|
messageBus: IFrameMessageBus|null = null;
|
2020-01-27 18:40:18 +00:00
|
|
|
@ViewChild('ref') iframe: ElementRef;
|
|
|
|
|
}
|