-
Notifications
You must be signed in to change notification settings - Fork 174
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
Address TODOs #736
Address TODOs #736
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
let ready = false; | ||
let existingCall = null; | ||
const onInstance = 'onImsLibInstance'; | ||
|
||
const onImsReady = (timeout = 3000) => { | ||
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. where is this imported / called? 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. It's currently not used anywhere, but we want to avoid using 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. 👍 For 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. The event is triggered to allow communication with imslib and get the instance; the name should not be changed. |
||
existingCall = existingCall || new Promise((resolve, reject) => { | ||
const onFail = () => { | ||
if (!ready) reject(); | ||
}; | ||
const waitTimeout = setTimeout(onFail, timeout); | ||
const onSuccess = (data) => { | ||
const instance = data?.detail?.instance; | ||
if (!instance) { | ||
reject(); | ||
return; | ||
} | ||
|
||
ready = true; | ||
window.removeEventListener(onInstance, onSuccess); | ||
clearTimeout(waitTimeout); | ||
resolve(instance); | ||
}; | ||
|
||
window.addEventListener(onInstance, onSuccess); | ||
window.dispatchEvent(new window.CustomEvent('getImsLibInstance')); | ||
overmyheadandbody marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
return existingCall; | ||
}; | ||
|
||
export default onImsReady; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,7 @@ const config = { | |
fallbackRouting: 'on', | ||
links: 'on', | ||
imsClientId: 'milo', | ||
imsScope: 'AdobeID,openid,gnav', | ||
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. I wish there was a better place to put this stuff. In five years, the config object is going to be huge. 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. Wouldn't help with size, but we could use nested obj to organize it better. |
||
codeRoot: '/libs', | ||
locales, | ||
prodDomains, | ||
|
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.
We actually do need to review this, albeit after MVP. We do have a story for it, so I guess it's ok to remove the comment for now 🤷
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.
Correct, this is something I mentioned in the description, we can handle the app launcher as part of the upcoming story (post mvp).