Skip to content

Commit

Permalink
Merge branch 'main' of github.com:exadel-inc/esl into epic/esl-event-…
Browse files Browse the repository at this point in the history
…helpers-v4.12
  • Loading branch information
ala-n committed Aug 29, 2023
2 parents c7d484e + 467ae20 commit 3d7b4af
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 98 deletions.
184 changes: 92 additions & 92 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
"@semantic-release/release-notes-generator": "^11.0.7",
"@types/jest": "^29.5.4",
"@types/smoothscroll-polyfill": "^0.3.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"@webcomponents/custom-elements": "1.6.0",
"chokidar-cli": "^3.0.0",
"clean-css-cli": "^5.6.2",
Expand Down
13 changes: 9 additions & 4 deletions src/modules/esl-event-listener/core/targets/resize.adapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SyntheticEventTarget} from '../../../esl-utils/dom/events/target';
import {isElement} from '../../../esl-utils/dom/api';
import {resolveDomTarget} from '../../../esl-utils/abstract/dom-target';
import {ESLElementResizeEvent} from './resize.adapter.event';

Expand Down Expand Up @@ -29,16 +30,20 @@ export class ESLResizeObserverTarget extends SyntheticEventTarget {
}

/** Creates {@link ESLResizeObserverTarget} instance for the {@link ESLDomElementTarget} */
public static for(target: ESLDomElementTarget): ESLResizeObserverTarget {
return new ESLResizeObserverTarget(target);
public static for(target: ESLDomElementTarget): ESLResizeObserverTarget;
public static for(target: ESLDomElementTarget): ESLResizeObserverTarget | null {
const $target = resolveDomTarget(target);
if (isElement($target)) return new ESLResizeObserverTarget($target);
// Error handling
console.warn('[ESL]: ESLResizeObserverTarget can not observe %o', target);
return null;
}

/**
* Creates {@link ESLResizeObserverTarget} for the {@link ESLDomElementTarget}.
* Note the {@link ESLResizeObserverTarget} instances are singletons relatively to the {@link Element}
*/
protected constructor(target: ESLDomElementTarget) {
target = resolveDomTarget(target);
protected constructor(target: Element) {
const instance = ESLResizeObserverTarget.mapping.get(target);
if (instance) return instance;

Expand Down
Loading

0 comments on commit 3d7b4af

Please sign in to comment.