本文整理汇总了TypeScript中react-cosmos-shared2/util.uuid函数的典型用法代码示例。如果您正苦于以下问题:TypeScript uuid函数的具体用法?TypeScript uuid怎么用?TypeScript uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uuid函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getRendererId
// Renderer ID is remembered to avoid announcing a new renderer when reloading
// the renderer window. Note that each tab has creates a new session and thus
// a new rendererId.
// https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
function getRendererId(): RendererId {
let rId = sessionStorage.getItem('cosmosRendererId');
if (!rId) {
rId = uuid();
sessionStorage.setItem('cosmosRendererId', rId);
}
return rId;
}
开发者ID:skidding,项目名称:cosmos,代码行数:14,代码来源:rendererId.ts
示例2: uuid
import { uuid } from 'react-cosmos-shared2/util';
import retry from '@skidding/async-retry';
import { runFixtureLoaderTests } from '../testHelpers';
const rendererId = uuid();
const fixtures = { first: 'First' };
const decorators = {};
const fixtureId = { path: 'first', name: null };
runFixtureLoaderTests(mount => {
it('fires change callback when selecting fixture', async () => {
const onFixtureChange = jest.fn();
await mount(
{ rendererId, fixtures, decorators, onFixtureChange },
async ({ selectFixture }) => {
await selectFixture({
rendererId,
fixtureId,
fixtureState: {}
});
await retry(() => expect(onFixtureChange).toBeCalledTimes(1));
}
);
});
it('fires change callback when unselecting fixture', async () => {
const onFixtureChange = jest.fn();
await mount(
{ rendererId, fixtures, decorators, onFixtureChange },
async ({ selectFixture, unselectFixture }) => {
await selectFixture({
开发者ID:skidding,项目名称:cosmos,代码行数:31,代码来源:changeCallback.ts
注:本文中的react-cosmos-shared2/util.uuid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论