mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-29 01:30:16 +02:00
code mode functionality added
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import {
|
||||
trackEvent
|
||||
} from './analytics';
|
||||
|
||||
import {
|
||||
deferred
|
||||
} from './deferred';
|
||||
window.DEBUG = document.cookie.indexOf('wmdebug') > -1;
|
||||
|
||||
window.$ = document.querySelector.bind(document);
|
||||
@@ -80,7 +84,7 @@
|
||||
|
||||
export function log() {
|
||||
if (window.DEBUG) {
|
||||
console.log(...arguments);
|
||||
console.log(Date.now(), ...arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,6 +277,19 @@
|
||||
);
|
||||
}
|
||||
|
||||
export function loadJS(src) {
|
||||
var d = deferred();
|
||||
var ref = window.document.getElementsByTagName('script')[0];
|
||||
var script = window.document.createElement('script');
|
||||
script.src = src;
|
||||
script.async = true;
|
||||
ref.parentNode.insertBefore(script, ref);
|
||||
script.onload = function () {
|
||||
d.resolve();
|
||||
};
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
window.chrome = window.chrome || {};
|
||||
window.chrome.i18n = {
|
||||
getMessage: () => {}
|
||||
|
Reference in New Issue
Block a user