// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(crbug.com/1146002): Replace this import as soon as
// we are able to use `import as * ...` across the codebase
// in the following files:
// LinearMemoryNavigator.ts
// LinearMemoryValueInterpreter.ts
import '../../ui/components/Icon.js';
import * as ComponentHelpers from '../../component_helpers/component_helpers.js';
import * as LinearMemoryInspector from '../../linear_memory_inspector/linear_memory_inspector.js';

await ComponentHelpers.ComponentServerSetup.setup();

const array = [];
const string = 'Hello this is a string from the memory buffer!';

for (let i = 0; i < string.length; ++i) {
  array.push(string.charCodeAt(i));
}

for (let i = -1000; i < 1000; ++i) {
  array.push(i);
}

const memory = new Uint8Array(array);
const memoryInspector = new LinearMemoryInspector.LinearMemoryInspector.LinearMemoryInspector();
document.getElementById('container')?.appendChild(memoryInspector);

memoryInspector.data = {
  memory: memory,
  address: 0,
  memoryOffset: 0,
  outerMemoryLength: memory.length,
};

// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import * as ComponentHelpers from '../../component_helpers/component_helpers.js';
import * as LinearMemoryInspector from '../../linear_memory_inspector/linear_memory_inspector.js';

await ComponentHelpers.ComponentServerSetup.setup();

const array = [];
const string = 'Hello this is a string from the memory buffer!';

for (let i = 0; i < string.length; ++i) {
  array.push(string.charCodeAt(i));
}

for (let i = -1000; i < 1000; ++i) {
  array.push(i);
}

const memory = new Uint8Array(array);
const memoryInspector = new LinearMemoryInspector.LinearMemoryInspector.LinearMemoryInspector();
document.getElementById('container')?.appendChild(memoryInspector);

memoryInspector.data = {
  memory: memory,
  address: 0,
  memoryOffset: 0,
  outerMemoryLength: memory.length,
};

Remove old TODO from linear_memory_inspector example
Remove old TODO from linear_memory_inspector example

This TODO is not required any more; the source files do declare a dep on
the UI Components folder which house the icon.

The associated bug should remain open as there is more work to do to
make declaring component dependencies easier (LitHtml 2 should help
here).

Change-Id: I9375e2dc8dbd781be86522daaa3023699942e52b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2617788
Commit-Queue: Jack Franklin <993fcadce4d04090da2fefd557a0995e7966c8d5@chromium.org>
Reviewed-by: Kim-Anh Tran <a72f38a79b5fac6811022b8a7fb84830d856c9c9@chromium.org>
