-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create @ui5/webcomponents-ie11 package (#2686)
- Loading branch information
1 parent
ad56eaa
commit 1d3b37e
Showing
83 changed files
with
536 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const observers = new WeakMap(); // We want just one observer per node, store them here -> DOM nodes are keys | ||
|
||
/** | ||
* Default implementation with MutationObserver for browsers with native support | ||
*/ | ||
let _createObserver = (node, callback, options) => { | ||
const observer = new MutationObserver(callback); | ||
observer.observe(node, options); | ||
return observer; | ||
}; | ||
|
||
/** | ||
* Default implementation with MutationObserver for browsers with native support | ||
*/ | ||
let _destroyObserver = observer => { | ||
observer.disconnect(); | ||
}; | ||
|
||
/** | ||
* Allows to create an alternative DOM observer implementation | ||
* @param createFn | ||
*/ | ||
const setCreateObserverCallback = createFn => { | ||
_createObserver = createFn; | ||
}; | ||
|
||
/** | ||
* Allows to create an alternative DOM observer implementation | ||
* @param destroyFn | ||
*/ | ||
const setDestroyObserverCallback = destroyFn => { | ||
_destroyObserver = destroyFn; | ||
}; | ||
|
||
/** | ||
* @param node | ||
* @param callback | ||
* @param options | ||
*/ | ||
const observeDOMNode = (node, callback, options) => { | ||
const observer = _createObserver(node, callback, options); | ||
observers.set(node, observer); | ||
}; | ||
|
||
/** | ||
* @param node | ||
*/ | ||
const unobserveDOMNode = node => { | ||
const observer = observers.get(node); | ||
if (observer) { | ||
_destroyObserver(observer); | ||
observers.delete(node); | ||
} | ||
}; | ||
|
||
export { | ||
setCreateObserverCallback, | ||
setDestroyObserverCallback, | ||
observeDOMNode, | ||
unobserveDOMNode, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.