Wait for usw-readybefore sending style

This commit is contained in:
Gusted 2021-06-08 18:32:01 +02:00
parent b1d7e4caf3
commit 62791cda82
No known key found for this signature in database
GPG Key ID: FD821B732837125F

View File

@ -16,14 +16,15 @@
&& allowedOrigin === event.origin && allowedOrigin === event.origin
) { ) {
sendPostMessage({type: 'usw-remove-stylus-button'}); sendPostMessage({type: 'usw-remove-stylus-button'});
}
};
if (window.location.pathname === '/api/oauth/authorize_style/new') { if (window.location.pathname === '/api/oauth/authorize_style/new') {
API.styles.find({_linking: true}).then(style => { API.styles.find({_linking: true}).then(style => {
console.log(style);
sendPostMessage({type: 'usw-fill-new-style', data: style}); sendPostMessage({type: 'usw-fill-new-style', data: style});
}); });
} }
}
};
window.addEventListener('message', onPageLoaded); window.addEventListener('message', onPageLoaded);
})(); })();