-
Notifications
You must be signed in to change notification settings - Fork 107
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
Async id function? #106
Comments
As an option: class AsyncIDEmbed extends Embed {
async onPaste(event) {
const { key: service, data: url } = event.detail;
const { regex, embedUrl, width, height, id = async (ids) => ids.shift() } = Embed.services[service];
const result = regex.exec(url).slice(1);
const embed = embedUrl.replace(/<%= remote_id %>/g, await id(result));
this.data = {
service,
source: url,
embed,
width,
height,
};
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know now it is not an option but imagine this use case. If you paste shorten link to sketchfab (for example https://skfb.ly/oDtnZ) you need to make request to this url and follow redirects to find real id to be inserted in iframe. So the id function would be like this:
The text was updated successfully, but these errors were encountered: