Move getMemory where it belongs

This commit is contained in:
Kuba Orlik 2021-11-07 17:23:48 +01:00
parent 2bd4e8b9da
commit 729a60a998
7 changed files with 15 additions and 10 deletions

View File

@ -69,3 +69,7 @@ export function init() {
(window as any).memory = memory;
}
export function getMemory(): Memory {
return (browser.extension.getBackgroundPage().window as any).memory as Memory;
}

View File

@ -1,6 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";
import { getMemory } from "../util";
import { getMemory } from "../memory";
function Report() {
const origin = new URL(document.location.toString()).searchParams.get(

View File

@ -2,7 +2,8 @@ import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom";
import Options from "../options";
import { StolenData } from "./stolen-data";
import { getMemory, useEmitter } from "../util";
import { useEmitter } from "../util";
import { getMemory } from "../memory";
async function getCurrentTab() {
const [tab] = await browser.tabs.query({

View File

@ -1,7 +1,8 @@
import React from "react";
import { getMemory } from "../memory";
import { MergedStolenDataEntry, Sources } from "../stolen-data-entry";
import { MergedStolenDataEntry, Sources } from "../request-cluster";
import { getMemory, hyphenate } from "../util";
import { hyphenate } from "../util";
function StolenDataValueTable({
entry,

View File

@ -1,7 +1,9 @@
import React from "react";
import { RequestCluster } from "../request-cluster";
import StolenDataCluster from "./stolen-data-cluster";
import { getMemory, getshorthost } from "../util";
import { getshorthost } from "../util";
import { getMemory } from "../memory";
export function StolenData({
origin,

View File

@ -1,6 +1,7 @@
import { TCModel } from "@iabtcf/core";
import ExtendedRequest from "./extended-request";
import { getMemory, isJSONObject, isURL, parseToObject } from "./util";
import { getMemory } from "./memory";
import { isJSONObject, isURL, parseToObject } from "./util";
export type Sources = "cookie" | "pathname" | "queryparams" | "header";

View File

@ -83,10 +83,6 @@ export function hyphenate(str: string): string {
return str.replace(/[_\[A-Z]/g, `${String.fromCharCode(173)}$&`);
}
export function getMemory(): Memory {
return (browser.extension.getBackgroundPage().window as any).memory as Memory;
}
export function unique(array: string[]) {
return Array.from(new Set(array));
}