mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 22:47:03 +03:00
es5 -> es2015 (last stage)
Signature plugin fixes Add view decorator A large number of fixes
This commit is contained in:
parent
e88c193334
commit
17669b7be0
153 changed files with 21193 additions and 21115 deletions
54
dev/Common/Jassl.js
Normal file
54
dev/Common/Jassl.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
import window from 'window';
|
||||
import Promise from 'Promise';
|
||||
|
||||
// let rainloopCaches = window.caches && window.caches.open ? window.caches : null;
|
||||
|
||||
/**
|
||||
* @param {src} src
|
||||
* @param {boolean} async = false
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function jassl(src, async = false) {
|
||||
|
||||
if (!Promise || !Promise.all)
|
||||
{
|
||||
throw new Error('Promises are not available your environment.');
|
||||
}
|
||||
|
||||
if (!src)
|
||||
{
|
||||
throw new Error('src should not be empty.');
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const element = window.document.createElement('script');
|
||||
|
||||
element.onload = () => {
|
||||
resolve(src);
|
||||
};
|
||||
|
||||
element.onerror = () => {
|
||||
reject(new Error(src));
|
||||
};
|
||||
|
||||
element.async = true === async;
|
||||
element.src = src;
|
||||
|
||||
window.document.body.appendChild(element);
|
||||
})/* .then((s) => {
|
||||
|
||||
const found = s && rainloopCaches ? s.match(/rainloop\/v\/([^\/]+)\/static\//) : null;
|
||||
if (found && found[1])
|
||||
{
|
||||
rainloopCaches.open('rainloop-offline-' + found[1]).then(
|
||||
(cache) => cache.add(s)
|
||||
).catch(() => {
|
||||
rainloopCaches = null;
|
||||
});
|
||||
}
|
||||
|
||||
return s;
|
||||
})*/;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue