...
|
...
|
@@ -43,25 +43,23 @@ function unregister() { |
|
|
}
|
|
|
|
|
|
window.addEventListener('load', function() {
|
|
|
if (yoho.isApp) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ('serviceWorker' in navigator && isHttps) {
|
|
|
$.ajax({
|
|
|
url: '//m.yohobuy.com/api/switch',
|
|
|
dataType: 'jsonp',
|
|
|
cache: false,
|
|
|
success(res) {
|
|
|
const usePwa = isHttps && res && res.usePwa;
|
|
|
if (!yoho.isApp) {
|
|
|
if ('serviceWorker' in navigator && isHttps) {
|
|
|
$.ajax({
|
|
|
url: '//m.yohobuy.com/api/switch',
|
|
|
dataType: 'jsonp',
|
|
|
cache: false,
|
|
|
success(res) {
|
|
|
const usePwa = isHttps && res && res.usePwa;
|
|
|
|
|
|
if (usePwa) {
|
|
|
register();
|
|
|
} else {
|
|
|
unregister();
|
|
|
if (usePwa) {
|
|
|
register();
|
|
|
} else {
|
|
|
unregister();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
|