当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript NgZone.runOutsideAngular方法代码示例

本文整理汇总了TypeScript中@angular/core.NgZone.runOutsideAngular方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NgZone.runOutsideAngular方法的具体用法?TypeScript NgZone.runOutsideAngular怎么用?TypeScript NgZone.runOutsideAngular使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/core.NgZone的用法示例。


在下文中一共展示了NgZone.runOutsideAngular方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: applyChanges

	private applyChanges(changes: KeyValueChanges<string, Layer>, addFn: (layer: Layer, name: string) => void): LeafletControlLayersChanges {
		const results: LeafletControlLayersChanges = new LeafletControlLayersChanges();

		if (null != changes) {

			// All layer management is outside angular to avoid layer events from triggering change detection
			this.zone.runOutsideAngular(() => {

				changes.forEachChangedItem((c) => {
					this.layersControl.removeLayer(c.previousValue);
					addFn.call(this.layersControl, c.currentValue, c.key);
					results.layersChanged++;
				});
				changes.forEachRemovedItem((c) => {
					this.layersControl.removeLayer(c.previousValue);
					results.layersRemoved++;
				});
				changes.forEachAddedItem((c) => {
					addFn.call(this.layersControl, c.currentValue, c.key);
					results.layersAdded++;
				});

			});

		}

		return results;
	}
开发者ID:misteronak,项目名称:Verion-1.0-Donation-Dashboard,代码行数:28,代码来源:leaflet-control-layers.wrapper.ts

示例2: setTimeout

 public setTimeout(action: any, timeout?: any): void {
     this._ngZone.runOutsideAngular(() => {
         window.setTimeout(() => {
             action();
         }, timeout);
     });
 }
开发者ID:ceolter,项目名称:ag-grid,代码行数:7,代码来源:ng2FrameworkFactory.ts

示例3: updateLayers

	/**
	 * Update the state of the layers.
	 * We use an iterable differ to synchronize the map layers with the state of the bound layers array.
	 * This is important because it allows us to react to changes to the contents of the array as well
	 * as changes to the actual array instance.
	 */
	private updateLayers() {

		const map = this.leafletDirective.getMap();

		if (null != map && null != this.layersDiffer) {

			const changes = this.layersDiffer.diff(this.layersValue);
			if (null != changes) {

				// Run outside angular to ensure layer events don't trigger change detection
				this.zone.runOutsideAngular(() => {

					changes.forEachRemovedItem((c) => {
						map.removeLayer(c.item);
					});
					changes.forEachAddedItem((c) => {
						map.addLayer(c.item);
					});

				});

			}

		}

	}
开发者ID:misteronak,项目名称:Verion-1.0-Donation-Dashboard,代码行数:32,代码来源:leaflet-layers.directive.ts

示例4: macroTask

           macroTask(() => {
             _zone.runOutsideAngular(
                 () => { promise = Promise.resolve(4).then((x) => Promise.resolve(x)); });

             promise.then(_log.fn('promise then'));
             _log.add('zone run');
           });
开发者ID:Cammisuli,项目名称:angular,代码行数:7,代码来源:ng_zone_spec.ts

示例5: constructor

  constructor(private _platform: Platform, ngZone: NgZone) {
    this._change = _platform.isBrowser ? ngZone.runOutsideAngular(() => {
      return merge<Event>(fromEvent(window, 'resize'), fromEvent(window, 'orientationchange'));
    }) : observableOf();

    this._invalidateCache = this.change().subscribe(() => this._updateViewportSize());
  }
开发者ID:ozee,项目名称:material2,代码行数:7,代码来源:viewport-ruler.ts

示例6: ngOnInit

 ngOnInit(): void {
     if (this.table.settings.hoverEvents) {
         this.ngZone.runOutsideAngular(() => {
             this.element.addEventListener('mouseover', this.onMouseover.bind(this));
             this.element.addEventListener('mouseout', this.onMouseout.bind(this));
         });
     }
 }
开发者ID:mazdik,项目名称:Angularjs_aion,代码行数:8,代码来源:body-mouseover.directive.ts

示例7: playVideo

 playVideo(media: GoogleApiYouTubeVideoResource, seconds?: number) {
   const id = media.id;
   const isLoaded = this.player.getVideoUrl().includes(id);
   if (!isLoaded) {
     this.zone.runOutsideAngular(() => this.player.loadVideoById(id, seconds || undefined));
   }
   this.play();
 }
开发者ID:blackshadow17,项目名称:echoPlayer,代码行数:8,代码来源:youtube-player.service.ts

示例8: ngOnInit

 ngOnInit(): void {
     const editable = this.table.columns.some(x => x.editable);
     if (editable) {
         this.ngZone.runOutsideAngular(() => {
             this.element.addEventListener('dblclick', this.onDblClick.bind(this));
         });
     }
 }
开发者ID:mazdik,项目名称:Angularjs_aion,代码行数:8,代码来源:body-dblclick.directive.ts

示例9: Error

 .then(() => {
     if (this.localStorageService.clearAll()) {
         this.zone.runOutsideAngular(() => {
             location.reload();
         });
     } else {
         throw new Error('Failed to clear local storage');
     }
 });
开发者ID:bloonbullet,项目名称:composer,代码行数:9,代码来源:version-check.component.ts

示例10: ngAfterViewInit

 ngAfterViewInit() {
   this._ngZone.runOutsideAngular(() => {
     let self: MatchPageComponent = this;
     function step() {
       self.onFrame();
       self.requestAnimationFrameHandle = window.requestAnimationFrame(step);
     }
     self.requestAnimationFrameHandle = window.requestAnimationFrame(step);
   });
 }
开发者ID:djmclaugh,项目名称:OSASG,代码行数:10,代码来源:match-page.component.ts


注:本文中的@angular/core.NgZone.runOutsideAngular方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。