@angular/core#RendererFactory2 TypeScript Examples

The following examples show how to use @angular/core#RendererFactory2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: component-creator.service.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(
    @Inject(DOCUMENT)
    private readonly document: Document,
    private readonly rendererFactory: RendererFactory2,
    private readonly appRef: ApplicationRef,
    private readonly componentFactoryResolver: ComponentFactoryResolver,
    private readonly injector: Injector,
    private ngZone: NgZone
  ) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #2
Source File: mini-program.module.ts    From angular-miniprogram with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [],
  imports: [CommonModule, ApplicationModule],
  providers: [
    { provide: ɵINJECTOR_SCOPE, useValue: 'root' },
    { provide: ErrorHandler, useFactory: errorHandler, deps: [] },
    MiniProgramRendererFactory,
    {
      provide: RendererFactory2,
      useExisting: MiniProgramRendererFactory,
    },
    PageService,
    ComponentFinderService,
  ],
  exports: [CommonModule, ApplicationModule],
})
export class MiniProgramModule {
  constructor(pageService: PageService) {
    pageService.register();
  }
}
Example #3
Source File: mini-program.renderer.factory.ts    From angular-miniprogram with MIT License 6 votes vote down vote up
@Injectable()
export class MiniProgramRendererFactory implements RendererFactory2 {
  defaultRenderer!: MiniProgramRenderer;
  constructor() {
    this.defaultRenderer = new MiniProgramRenderer();
  }

  createRenderer(element: AgentNode, type: RendererType2 | null): Renderer2 {
    return this.defaultRenderer;
  }
  begin() {}
  end() {
    endRender();
  }
}
Example #4
Source File: dropdown.service.ts    From sba-angular with MIT License 6 votes vote down vote up
constructor(
        @Inject(DOCUMENT) public readonly document: Document,
        rendererFactory: RendererFactory2
    ) {
        this._events = new Subject<DropdownEvents>();
        this.renderer = rendererFactory.createRenderer(null, null);
        this.unlisteners = [];
        this.unlisteners.push(this.renderer.listen(this.document, "keydown", this.dataApiKeydownHandler));
        this.unlisteners.push(this.renderer.listen(this.document, "click", this.clearMenus));
        this.unlisteners.push(this.renderer.listen(this.document, "keyup", this.clearMenus));
        this.unlisteners.push(this.renderer.listen(this.document, "click", this.toggle));
        this.unlisteners.push(this.renderer.listen(this.document, "click", this.formChildClick));
        this.unlisteners.push(this.renderer.listen(this.document, "wheel", () => {
            this.raiseClear();
            this.raiseActive(false);
        }));
    }
Example #5
Source File: dialog.service.ts    From mysteryofthreebots with Apache License 2.0 6 votes vote down vote up
constructor(
    rendererFactory: RendererFactory2,
    private readonly resolver: ComponentFactoryResolver,
    private readonly injector: Injector,
    private readonly appRef: ApplicationRef,
    @Inject(DOCUMENT) private readonly document: HTMLDocument
  ) {
    this.renderer = rendererFactory.createRenderer(null, null);
    this.handleCloseDialog = this.handleCloseDialog.bind(this);
  }
Example #6
Source File: outletService.ts    From ngx-dynamic-hooks with MIT License 6 votes vote down vote up
constructor(
    @Optional() @Inject(DYNAMICHOOKS_GLOBALSETTINGS) private globalSettings: DynamicHooksGlobalSettings,
    private parserEntryResolver: ParserEntryResolver,
    private optionsResolver: OptionsResolver,
    private hooksReplacer: HooksReplacer,
    private componentCreator: ComponentCreator,
    private rendererFactory: RendererFactory2,
    private injector: Injector
  ) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #7
Source File: modals.service.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(
    @Inject(DOCUMENT)
    private readonly document: Document,
    private readonly rendererFactory: RendererFactory2,
    private readonly appRef: ApplicationRef,
    private readonly componentFactoryResolver: ComponentFactoryResolver,
    private readonly injector: Injector,
  ) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #8
Source File: qr-scanner.service.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(
    private qrScanner: QRScanner,
    private readonly rendererFactory2: RendererFactory2,
    @Inject(DOCUMENT)
    private document: Document,
    private readonly nzDrawerService: NzDrawerService,
  ) {
    this.renderer2 = rendererFactory2.createRenderer(null, null);
  }
Example #9
Source File: hooksReplacer.ts    From ngx-dynamic-hooks with MIT License 5 votes vote down vote up
constructor(rendererFactory: RendererFactory2, private platform: PlatformService) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #10
Source File: componentCreator.ts    From ngx-dynamic-hooks with MIT License 5 votes vote down vote up
constructor(private cfr: ComponentFactoryResolver, private appRef: ApplicationRef, private rendererFactory: RendererFactory2, private componentUpdater: ComponentUpdater, private platform: PlatformService) {
    this.renderer = this.rendererFactory.createRenderer(null, null);
  }
Example #11
Source File: viewport.service.ts    From App with MIT License 5 votes vote down vote up
constructor(
		@Inject(DOCUMENT) private document: Document,
		private windowRef: WindowRef,
		private ngZone: NgZone, media: MediaMatcher,
		renderFactory2: RendererFactory2
	) {
		this.query.xs = media.matchMedia('(max-width: 576px)');
		this.query.sm = media.matchMedia('(min-width: 576px)');
		this.query.md = media.matchMedia('(min-width: 768px)');
		this.query.lg = media.matchMedia('(min-width: 992px)');
		this.query.xl = media.matchMedia('(min-width: 1200px)');
		(() => {
			let index = 0;
			for (const size of this.BREAKPOINT_NAMES) {
				++index;
				this.queryIndex[index] = size;
			}
		})();

		AppComponent.isBrowser.pipe(
			filter(isBrowser => isBrowser === true),
			tap(() => {
				const win = this.windowRef.getNativeWindow();
				if (!win) return;

				win.onresize = (ev: UIEvent) => {
					this.ngZone.run(() => {
						this.height = document.body.offsetHeight;
						this.width = document.body.offsetWidth;
						this.appResize.emit('window');

						this.checkBreakpoint();
					});
				};
			})
		).subscribe();


		this.height = document.body.offsetHeight;
		this.width = document.body.offsetWidth;
		this.checkBreakpoint();

		// Update mouse position
		{
			const renderer = renderFactory2.createRenderer(null, null);
			renderer.listen('document', 'mousemove', (ev: MouseEvent) => {
				this.mouseX = ev.x;
				this.mouseY = ev.y;
			});
		}
	}
Example #12
Source File: ngx-tippy.service.ts    From ngx-tippy-wrapper with MIT License 5 votes vote down vote up
private createRenderer(rendererFactory: RendererFactory2) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #13
Source File: ngx-tippy.service.ts    From ngx-tippy-wrapper with MIT License 5 votes vote down vote up
constructor(
    rendererFactory: RendererFactory2,
    private devModeService: DevModeService,
    private ngxViewService: NgxViewService,
    @Inject(NGX_TIPPY_MESSAGES) private messagesDict: NgxTippyMessagesDict
  ) {
    this.createRenderer(rendererFactory);
  }
Example #14
Source File: iframe.service.ts    From rubic-app with GNU General Public License v3.0 5 votes vote down vote up
constructor(
    @Inject(DOCUMENT) private readonly document: Document,
    private readonly rendererFactory2: RendererFactory2,
    @Inject(WINDOW) private readonly window: Window,
    private readonly promotionPromoterAddressApiService: PromotionPromoterAddressApiService
  ) {}
Example #15
Source File: tour-backdrop.service.ts    From ngx-ui-tour with MIT License 5 votes vote down vote up
constructor(rendererFactory: RendererFactory2) {
        this.renderer = rendererFactory.createRenderer(null, null);
    }
Example #16
Source File: base-modal.ts    From ng-ant-admin with MIT License 5 votes vote down vote up
constructor(private baseInjector: Injector, public dragDrop: DragDrop, rendererFactory: RendererFactory2) {
    this.bsModalService = this.baseInjector.get(NzModalService);
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #17
Source File: theme.service.ts    From ewelink-web-ui with MIT License 5 votes vote down vote up
constructor(
    @Inject(DOCUMENT) private document: Document,
    rendererFactory: RendererFactory2
  ) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #18
Source File: theme.service.ts    From matx-angular with MIT License 5 votes vote down vote up
constructor(
    @Inject(DOCUMENT) private document: Document,
    rendererFactory: RendererFactory2
  ) {
    this.renderer = rendererFactory.createRenderer(null, null);
  }
Example #19
Source File: dom.service.ts    From data-annotator-for-machine-learning with Apache License 2.0 5 votes vote down vote up
constructor(private rendererFactory: RendererFactory2) {
    this.renderer = this.rendererFactory.createRenderer(null, null);
  }
Example #20
Source File: clipboard.service.ts    From xBull-Wallet with GNU Affero General Public License v3.0 5 votes vote down vote up
constructor(
    private readonly rendererFactory2: RendererFactory2,
    @Inject(DOCUMENT) private readonly document: Document,
  ) {
    this.renderer = this.rendererFactory2.createRenderer(null, null);
  }