5 | The purpose of this test is to ensure that streams are unsubscribed when the pipe is 6 | destroyed. 7 |
8 | 9 |{{ '' | i18n }}10 | 11 |
├── .nvmrc
├── .husky
├── .gitignore
├── pre-commit
└── commit-msg
├── .eslintignore
├── .npmrc
├── .github
├── CODEOWNERS
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── until-destroy.yml
├── .prettierignore
├── apps
├── integration
│ ├── src
│ │ ├── polyfills.ts
│ │ ├── test-setup.ts
│ │ ├── app
│ │ │ ├── app.component.html
│ │ │ ├── array-of-subscriptions
│ │ │ │ ├── document-click
│ │ │ │ │ ├── document-click.component.html
│ │ │ │ │ └── document-click.component.ts
│ │ │ │ ├── array-of-subscriptions.module.ts
│ │ │ │ ├── array-of-subscriptions.component.html
│ │ │ │ └── array-of-subscriptions.component.ts
│ │ │ ├── app.component.scss
│ │ │ ├── enums
│ │ │ │ └── notification.enum.ts
│ │ │ ├── app.component.ts
│ │ │ ├── navbar
│ │ │ │ ├── navbar.component.html
│ │ │ │ ├── navbar.module.ts
│ │ │ │ └── navbar.component.ts
│ │ │ ├── destroyable-provider
│ │ │ │ ├── connection
│ │ │ │ │ ├── connection.directive.ts
│ │ │ │ │ └── connection.service.ts
│ │ │ │ ├── destroyable-provider.module.ts
│ │ │ │ ├── destroyable-provider.component.html
│ │ │ │ └── destroyable-provider.component.ts
│ │ │ ├── logger
│ │ │ │ └── logger.factory.ts
│ │ │ ├── pipe
│ │ │ │ ├── pipe.module.ts
│ │ │ │ ├── pipe.component.html
│ │ │ │ ├── pipe.component.ts
│ │ │ │ └── i18n.pipe.ts
│ │ │ ├── custom-method
│ │ │ │ ├── custom-method.module.ts
│ │ │ │ ├── interval.service.ts
│ │ │ │ ├── custom-method.component.html
│ │ │ │ └── custom-method.component.ts
│ │ │ ├── directive
│ │ │ │ ├── directive.module.ts
│ │ │ │ ├── directive.component.html
│ │ │ │ ├── directive.component.ts
│ │ │ │ └── http.directive.ts
│ │ │ ├── multiple-custom-methods
│ │ │ │ ├── multiple-custom-methods.module.ts
│ │ │ │ ├── multiple-custom-methods.component.html
│ │ │ │ ├── issue-66.service.ts
│ │ │ │ └── multiple-custom-methods.component.ts
│ │ │ ├── inheritance
│ │ │ │ ├── inheritance.module.ts
│ │ │ │ ├── issue-97
│ │ │ │ │ └── issue-97.component.ts
│ │ │ │ ├── inheritance.component.html
│ │ │ │ ├── inheritance.component.ts
│ │ │ │ └── issue-61
│ │ │ │ │ └── issue-61.component.ts
│ │ │ ├── app.module.ts
│ │ │ └── app.component.spec.ts
│ │ ├── environments
│ │ │ ├── environment.ts
│ │ │ └── environment.prod.ts
│ │ ├── main.ts
│ │ └── index.html
│ ├── tsconfig.editor.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.app.json
│ ├── .browserslistrc
│ ├── tsconfig.json
│ ├── jest.config.ts
│ ├── webpack.config.js
│ ├── .eslintrc.json
│ └── project.json
└── integration-e2e
│ ├── src
│ ├── plugins
│ │ └── index.js
│ ├── support
│ │ └── commands.js
│ └── integration
│ │ ├── pipe.spec.js
│ │ ├── directive.spec.js
│ │ ├── custom-method.spec.js
│ │ ├── destroyable-provider.spec.js
│ │ ├── array-of-subscriptions.spec.js
│ │ ├── inheritance.spec.js
│ │ └── multiple-custom-methods.spec.js
│ ├── tsconfig.json
│ ├── tsconfig.e2e.json
│ ├── .eslintrc.json
│ ├── cypress.json
│ └── project.json
├── .commitlintrc.json
├── libs
├── until-destroy
│ ├── src
│ │ ├── test-setup.ts
│ │ ├── index.ts
│ │ └── lib
│ │ │ ├── ivy.ts
│ │ │ ├── internals.ts
│ │ │ ├── until-destroy.ts
│ │ │ ├── until-destroyed.ts
│ │ │ └── checker.ts
│ ├── ng-package.json
│ ├── tests
│ │ ├── utils.ts
│ │ ├── until-destroy.spec.ts
│ │ └── until-destroyed.spec.ts
│ ├── tsconfig.spec.json
│ ├── tsconfig.json
│ ├── project.json
│ ├── tsconfig.lib.json
│ ├── jest.config.ts
│ ├── .eslintrc.json
│ └── package.json
└── until-destroy-migration
│ ├── src
│ ├── test-setup.ts
│ └── index.ts
│ ├── tsconfig.lib.json
│ ├── tsconfig.spec.json
│ ├── tests
│ ├── fixtures
│ │ ├── filled-onDestroy.service.ts
│ │ ├── single-import.component.ts
│ │ └── several-imports.component.ts
│ └── run.spec.ts
│ ├── tsconfig.json
│ ├── package.json
│ ├── jest.config.ts
│ ├── project.json
│ └── .eslintrc.json
├── jest.config.ts
├── .gitignore
├── tsconfig.base.json
├── jest.preset.js
├── LICENSE
├── .eslintrc.json
├── nx.json
├── CONTRIBUTING.md
├── .all-contributorsrc
├── package.json
├── README.md
└── CHANGELOG.md
/.nvmrc:
--------------------------------------------------------------------------------
1 | node
2 |
--------------------------------------------------------------------------------
/.husky/.gitignore:
--------------------------------------------------------------------------------
1 | _
2 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | strict-peer-dependencies=false
2 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @NetanelBasal @arturovt
2 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .cache
2 | dist
3 |
4 | /.nx/cache
--------------------------------------------------------------------------------
/apps/integration/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | import 'zone.js';
2 |
--------------------------------------------------------------------------------
/.commitlintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["@commitlint/config-conventional"]
3 | }
4 |
--------------------------------------------------------------------------------
/apps/integration-e2e/src/plugins/index.js:
--------------------------------------------------------------------------------
1 | module.exports = (on, config) => {};
2 |
--------------------------------------------------------------------------------
/apps/integration/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | import 'jest-preset-angular/setup-jest';
2 |
--------------------------------------------------------------------------------
/libs/until-destroy/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | import 'jest-preset-angular/setup-jest';
2 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | yarn lint-staged
5 |
--------------------------------------------------------------------------------
/libs/until-destroy-migration/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | import 'jest-preset-angular/setup-jest';
2 |
--------------------------------------------------------------------------------
/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | yarn commitlint --edit $1
5 |
--------------------------------------------------------------------------------
/apps/integration/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
Click on the document and see clientX is {{ clientX$ | async }}
2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.angular/cache 2 | node_modules 3 | .vscode 4 | /dist-test 5 | .idea 6 | dist 7 | .cache 8 | migrations.json 9 | .pnpm-debug.log 10 | 11 | .nx/cache -------------------------------------------------------------------------------- /apps/integration/tsconfig.editor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*.ts"], 4 | "compilerOptions": { 5 | "types": ["jest", "node"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/until-destroy/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/libs/until-destroy", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /apps/integration-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.e2e.json" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /apps/integration/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | ::ng-deep button { 2 | color: #fff; 3 | margin-top: 5px; 4 | margin-right: 5px; 5 | padding: 5px; 6 | box-sizing: border-box; 7 | border: 0; 8 | cursor: pointer; 9 | background-color: #007ad9; 10 | } 11 | -------------------------------------------------------------------------------- /libs/until-destroy/tests/utils.ts: -------------------------------------------------------------------------------- 1 | export function callNgOnDestroy(component: any): void { 2 | // The TS compiler will whine that this property doesn't on the component itself, 3 | // but this method will be added by our decorator. 4 | component.ngOnDestroy(); 5 | } 6 | -------------------------------------------------------------------------------- /apps/integration-e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "sourceMap": false, 6 | "skipLibCheck": true, 7 | "types": ["cypress", "node"] 8 | }, 9 | "include": ["src/**/*.ts", "src/**/*.js"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/until-destroy-migration/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/libs/until-destroy-migration" 6 | }, 7 | "files": ["src/index.ts"], 8 | "exclude": ["jest.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /apps/integration/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "types": ["jest", "node"] 6 | }, 7 | "files": ["src/test-setup.ts"], 8 | "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "jest.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /libs/until-destroy/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "types": ["jest", "node"] 6 | }, 7 | "files": ["src/test-setup.ts"], 8 | "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "jest.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /apps/integration/src/app/enums/notification.enum.ts: -------------------------------------------------------------------------------- 1 | export const enum NotificationClass { 2 | Danger = 'notification is-danger', 3 | Success = 'notification is-success' 4 | } 5 | 6 | export const enum NotificationText { 7 | Subscribed = 'Subscribed ⚠️', 8 | Unsubscribed = 'Unsubscribed ❤️🔥' 9 | } 10 | -------------------------------------------------------------------------------- /libs/until-destroy-migration/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "types": ["jest", "node"] 6 | }, 7 | "files": ["src/test-setup.ts"], 8 | "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "jest.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /libs/until-destroy-migration/tests/fixtures/filled-onDestroy.service.ts: -------------------------------------------------------------------------------- 1 | import { untilDestroyed } from 'ngx-take-until-destroy'; 2 | import { OnDestroy } from '@angular/core'; 3 | 4 | export class FilledOnDestroyService implements OnDestroy { 5 | ngOnDestroy() { 6 | throw new Error('Method not implemented.'); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /apps/integration/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "esnext", 5 | "target": "ES2022", 6 | "types": ["node"], 7 | "useDefineForClassFields": false 8 | }, 9 | "files": ["src/main.ts", "src/polyfills.ts"], 10 | "exclude": ["jest.config.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /apps/integration/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { ChangeDetectionStrategy, Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'], 7 | changeDetection: ChangeDetectionStrategy.OnPush 8 | }) 9 | export class AppComponent {} 10 | -------------------------------------------------------------------------------- /apps/integration-e2e/src/support/commands.js: -------------------------------------------------------------------------------- 1 | Cypress.Commands.add('shouldHaveSuccessClass', { prevSubject: 'element' }, $element => 2 | cy.wrap($element).should('have.class', 'is-success') 3 | ); 4 | 5 | Cypress.Commands.add('shouldHaveDangerClass', { prevSubject: 'element' }, $element => 6 | cy.wrap($element).should('have.class', 'is-danger') 7 | ); 8 | -------------------------------------------------------------------------------- /libs/until-destroy/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ], 13 | "compilerOptions": { 14 | "target": "es2020" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apps/integration/src/app/navbar/navbar.component.html: -------------------------------------------------------------------------------- 1 |5 | The purpose of this test is to ensure that streams are unsubscribed when the pipe is 6 | destroyed. 7 |
8 | 9 |{{ '' | i18n }}10 | 11 |
5 | The purpose of this test is to ensure that subscriptions, stored in array, are 6 | unsubscribed. 7 |
8 | 9 |5 | The purpose of this test is to ensure that streams are unsubscribed when directives are 6 | destroyed. 7 |
8 | 9 |10 |12 | 13 |{{ response }} 11 |
5 | The purpose of this test is to ensure that streams are unsubscribed when 6 | `ngOnDestroy()` is called on providers that are bound to components and directives 7 | (that are declared in `providers` property of components and directives). 8 |
9 | 10 |5 | The purpose of this test is to ensure that it's possible to use multiple custom methods 6 | that can be passed into `untilDestroyed` operator. 7 |
8 | 9 |10 | 13 | 16 | 19 | 22 |23 | 24 |
Issue#66 status:
25 | 26 |5 | The purpose of this test is to ensure that it's possible to pass custom method to 6 | `untilDestroyed` operator, that will be called upon destroy. Given such objectives: 7 |
8 |29 | Value from interval service {{ valueFromIntervalService$ | async }} 30 |31 |
5 | The purpose of this test is to ensure that inheritance from directives and abstract 6 | classes will work as expected. Note that there have been different issues: 7 |
8 |