-
Notifications
You must be signed in to change notification settings - Fork 275
feat: create @ui5/webcomponents-ie11 package #2686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2bd4fd3
feat: create @ui5/webcomponents-compatibility package
vladitasev 5571ec1
isLegacyBrowser
vladitasev 0f113d2
dom observer rework
vladitasev 665a67a
icon
vladitasev d95589b
Merge remote-tracking branch 'origin/master' into compat-package
vladitasev 9e7ca24
button example
vladitasev f515ae3
big refactoring
vladitasev 0c3abe0
use adapter
vladitasev cb58856
rename package
vladitasev b0d3772
rework DOMObserver & docs
vladitasev 3c7755c
rename
vladitasev d8deb47
rework with publish/subscribe
vladitasev c967520
method now unnecessary, removed
vladitasev 1e3100c
remove before theme loaded
vladitasev 1783c61
new boot hook name
vladitasev eed1b4f
Merge remote-tracking branch 'origin/master' into compat-package
vladitasev 1863118
reuse code
vladitasev ec91521
rename
vladitasev 4586140
fireAsync
vladitasev 8f1e4f6
also fix help
vladitasev 3bb47dd
comments
vladitasev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -136,6 +136,11 @@ If you need your application to run on Internet Explorer 11, there are some addi | |
*Note* These steps have been tested with Angular 7. For other versions of Angular, there might be some differences. | ||
|
||
1. Install all needed dependencies: | ||
|
||
```bash | ||
npm install @ui5/webcomponents-ie11 --save | ||
``` | ||
|
||
```bash | ||
npm install --save @angular-builders/[email protected] @angular-builders/[email protected] @babel/core @babel/preset-env babel-loader | ||
``` | ||
|
@@ -205,7 +210,7 @@ module.exports = { | |
|
||
4. Add the following import ```to app.module.ts``` file: | ||
```js | ||
import "@ui5/webcomponents-base/dist/features/browsersupport/IE11WithWebComponentsPolyfill.js"; | ||
import "@ui5/webcomponents-ie11/dist/features/IE11WithWebComponentsPolyfill.js"; | ||
``` | ||
|
||
*Note*: The ```IE11WithWebComponentsPolyfill.js``` file includes the official webcomponents polyfill, so you don’t have to import it by yourself. (This file was released in our latest @next version. It will be shipped with our next stable release rc.6, so until then it would be available only with the @next tag) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -36,7 +36,6 @@ class EventProvider { | |
|
||
/** | ||
* Fires an event and returns the results of all event listeners as an array. | ||
* Example: If listeners return promises, you can: await fireEvent("myEvent") to know when all listeners have finished. | ||
* | ||
* @param eventName the event to fire | ||
* @param data optional data to pass to each event listener | ||
|
@@ -55,6 +54,17 @@ class EventProvider { | |
}); | ||
} | ||
|
||
/** | ||
* Fires an event, awaits for all listeners' results to have resolved, and returns the results as an array. | ||
* | ||
* @param eventName the event to fire | ||
* @param data optional data to pass to each event listener | ||
* @returns {Array} an array with the results of all event listeners | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a single promise is returned, when resolved it will have the values |
||
*/ | ||
fireEventAsync(eventName, data) { | ||
return Promise.all(this.fireEvent(eventName, data)); | ||
} | ||
|
||
isHandlerAttached(eventName, fnFunction) { | ||
const eventRegistry = this._eventRegistry; | ||
const eventListeners = eventRegistry[eventName]; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically it doesn't await but returns the promises, could you change the description simply that it returns a promise and is always async?