當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。