我有一个cordova应用程序。我已经将Stripe与它集成在一起。 它很棒。 但是,当应用程序启动时没有网络连接 - 应用程序无法加载 - 我得到白屏。日志说 -
Failed to instantiate module angular-stripe due to:
Stripe must be available as window.Stripe
如何启用我的应用程序加载条带 - 即使没有活动的互联网。可能会延迟加载条纹?
答案 0 :(得分:0)
您可以在需要时延迟加载条带库。
let stripe = document.createElement('script');
stripe.src = 'https://checkout.stripe.com/checkout.js';
stripe.onload = function () {
// What do to do when the library is loaded
};
document.getElementsByTagName('head')[0].appendChild(stripe);