|
|
@@ -1,8 +1,7 @@
|
|
|
export { sendMessage, request, throttle } from 'src/common';
|
|
|
-export Promise from 'core-js/library/fn/promise';
|
|
|
|
|
|
// cache native properties to avoid being overridden, see violentmonkey/violentmonkey#151
|
|
|
-export const { console, CustomEvent } = window;
|
|
|
+export const { console, CustomEvent, Promise } = window;
|
|
|
|
|
|
export function postData(destId, data) {
|
|
|
// Firefox issue: data must be stringified to avoid cross-origin problem
|
|
|
@@ -22,27 +21,6 @@ export function inject(code) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// export function encodeObject(obj) {
|
|
|
-// if (Array.isArray(obj)) {
|
|
|
-// return obj.map(encodeObject).join(',');
|
|
|
-// }
|
|
|
-// if (typeof obj === 'function') {
|
|
|
-// let str = obj.toString();
|
|
|
-// const prefix = str.slice(0, str.indexOf('{'));
|
|
|
-// if (prefix.indexOf('=>') < 0 && prefix.indexOf('function ') < 0) {
|
|
|
-// // method definition
|
|
|
-// str = `function ${str}`;
|
|
|
-// }
|
|
|
-// return str;
|
|
|
-// }
|
|
|
-// if (obj && typeof obj === 'object') {
|
|
|
-// const pairs = Object.keys(obj)
|
|
|
-// .map(key => `${JSON.stringify(key)}:${encodeObject(obj[key])}`);
|
|
|
-// return `{${pairs.join(',')}}`;
|
|
|
-// }
|
|
|
-// return JSON.stringify(obj);
|
|
|
-// }
|
|
|
-
|
|
|
export function getUniqId() {
|
|
|
return Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
|
}
|