UNPKG

@wellwind/ngx-thanos

Version:

Use [Thanos](https://www.google.com/search?q=Thanos) snap to destory your DOM elements on Angular.

159 lines (152 loc) 4.92 kB
import { CommonModule } from '@angular/common'; import { Injectable, Directive, ElementRef, EventEmitter, Input, Output, NgModule, defineInjectable } from '@angular/core'; import { thanosRewind, thanosSnap } from '@wellwind/thanos-snap'; import { from } from 'rxjs'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ThanosSnapService = /** @class */ (function () { function ThanosSnapService() { } /** * @param {?} target * @return {?} */ ThanosSnapService.prototype.snap = /** * @param {?} target * @return {?} */ function (target) { return from(thanosSnap(target)); }; /** * @param {?} target * @return {?} */ ThanosSnapService.prototype.rewind = /** * @param {?} target * @return {?} */ function (target) { return from(thanosRewind(target)); }; ThanosSnapService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ ThanosSnapService.ctorParameters = function () { return []; }; /** @nocollapse */ ThanosSnapService.ngInjectableDef = defineInjectable({ factory: function ThanosSnapService_Factory() { return new ThanosSnapService(); }, token: ThanosSnapService, providedIn: "root" }); return ThanosSnapService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ThanosSnapDirective = /** @class */ (function () { function ThanosSnapDirective(elementRef, thanosSnapService) { this.elementRef = elementRef; this.thanosSnapService = thanosSnapService; this.ngxThanosSnap = false; this.snapStarting = new EventEmitter(); this.snapEnded = new EventEmitter(); this.rewinded = new EventEmitter(); } Object.defineProperty(ThanosSnapDirective.prototype, "host", { get: /** * @return {?} */ function () { return this.elementRef.nativeElement; }, enumerable: true, configurable: true }); /** * @return {?} */ ThanosSnapDirective.prototype.ngOnChanges = /** * @return {?} */ function () { if (this.ngxThanosSnap) { this.snap(); } else { this.rewind(); } }; /** * @return {?} */ ThanosSnapDirective.prototype.snap = /** * @return {?} */ function () { var _this = this; this.snapStarting.emit(); this.thanosSnapService.snap(this.host).subscribe((/** * @return {?} */ function () { return _this.snapEnded.emit(); })); }; /** * @return {?} */ ThanosSnapDirective.prototype.rewind = /** * @return {?} */ function () { var _this = this; this.thanosSnapService.rewind(this.host).subscribe((/** * @return {?} */ function () { return _this.rewinded.emit(); })); }; ThanosSnapDirective.decorators = [ { type: Directive, args: [{ selector: '[ngxThanosSnap]', exportAs: 'ngxThanosSnap' },] } ]; /** @nocollapse */ ThanosSnapDirective.ctorParameters = function () { return [ { type: ElementRef }, { type: ThanosSnapService } ]; }; ThanosSnapDirective.propDecorators = { ngxThanosSnap: [{ type: Input }], snapStarting: [{ type: Output }], snapEnded: [{ type: Output }], rewinded: [{ type: Output }] }; return ThanosSnapDirective; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxThanosModule = /** @class */ (function () { function NgxThanosModule() { } NgxThanosModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule], declarations: [ThanosSnapDirective], exports: [ThanosSnapDirective] },] } ]; return NgxThanosModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { NgxThanosModule, ThanosSnapDirective, ThanosSnapService }; //# sourceMappingURL=wellwind-ngx-thanos.js.map