Commit 521127dd authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Move `random.js` from `src/sidebar/util` to `src/shared`

This file will be useful for components in `src/annotator` so it will be
better to move it to common path for both the sidebar and annotator.
parent e7cdcc0d
/** @typedef {import('../../types/api').Annotation} Annotation */ /** @typedef {import('../../types/api').Annotation} Annotation */
/** @typedef {import('../../types/annotator').AnnotationData} AnnotationData */ /** @typedef {import('../../types/annotator').AnnotationData} AnnotationData */
import { generateHexString } from '../../shared/random';
import * as metadata from '../helpers/annotation-metadata'; import * as metadata from '../helpers/annotation-metadata';
import { import {
defaultPermissions, defaultPermissions,
privatePermissions, privatePermissions,
sharedPermissions, sharedPermissions,
} from '../helpers/permissions'; } from '../helpers/permissions';
import { generateHexString } from '../util/random';
/** /**
* A service for creating, updating and persisting annotations both in the * A service for creating, updating and persisting annotations both in the
......
import { generateHexString } from '../../shared/random';
import warnOnce from '../../shared/warn-once'; import warnOnce from '../../shared/warn-once';
import { generateHexString } from '../util/random';
import { Socket } from '../websocket'; import { Socket } from '../websocket';
import { watch } from '../util/watch'; import { watch } from '../util/watch';
......
import { generateHexString } from '../util/random'; import { generateHexString } from '../../shared/random';
// How long toast messages should be displayed before they are dismissed, in ms // How long toast messages should be displayed before they are dismissed, in ms
const MESSAGE_DISPLAY_TIME = 5000; const MESSAGE_DISPLAY_TIME = 5000;
......
import { generateHexString } from '../../shared/random';
import { fetchJSON } from './fetch'; import { fetchJSON } from './fetch';
import { generateHexString } from './random';
/** /**
* An object holding the details of an access token from the tokenUrl endpoint. * An object holding the details of an access token from the tokenUrl endpoint.
......
import { generateHexString } from './random'; import { generateHexString } from '../../shared/random';
/** Generate a random ID to associate RPC requests and responses. */ /** Generate a random ID to associate RPC requests and responses. */
function generateId() { function generateId() {
......
...@@ -214,7 +214,7 @@ describe('sidebar/util/oauth-client', () => { ...@@ -214,7 +214,7 @@ describe('sidebar/util/oauth-client', () => {
fakeWindow = new FakeWindow(); fakeWindow = new FakeWindow();
$imports.$mock({ $imports.$mock({
'./random': { '../../shared/random': {
generateHexString: () => 'notrandom', generateHexString: () => 'notrandom',
}, },
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment