本文整理汇总了TypeScript中uuid/v4.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Error
export async function downloadHelm(version?: string): Promise<string> {
if (!version) version = await getStableHelmVersion();
var cachedToolpath = toolLib.findLocalTool(helmToolName, version);
if (!cachedToolpath) {
try {
var helmDownloadPath = await toolLib.downloadTool(getHelmDownloadURL(version), helmToolName + "-" + version + "-" + uuidV4() + ".zip");
} catch (exception) {
throw new Error(tl.loc("HelmDownloadFailed", getHelmDownloadURL(version), exception));
}
var unzipedHelmPath = await toolLib.extractZip(helmDownloadPath);
cachedToolpath = await toolLib.cacheDir(unzipedHelmPath, helmToolName, version);
}
var helmpath = findHelm(cachedToolpath);
if (!helmpath) {
throw new Error(tl.loc("HelmNotFoundInFolder", cachedToolpath))
}
fs.chmodSync(helmpath, "777");
return helmpath;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:21,代码来源:helmutility.ts
示例2: createCellAbove
function createCellAbove(
state: NotebookModel,
action: actionTypes.CreateCellAbove
) {
const id = action.payload.id ? action.payload.id : state.cellFocused;
if (!id) {
return state;
}
const { cellType } = action.payload;
const cell = cellType === "markdown" ? emptyMarkdownCell : emptyCodeCell;
const cellId = uuid();
return state.update("notebook", (notebook: ImmutableNotebook) => {
const cellOrder: Immutable.List<CellId> = notebook.get(
"cellOrder",
Immutable.List()
);
const index = cellOrder.indexOf(id);
return insertCellAt(notebook, cell, cellId, index);
});
}
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:21,代码来源:notebook.ts
示例3: createCellBelow
function createCellBelow(
state: NotebookModel,
action: actionTypes.CreateCellBelow
): RecordOf<DocumentRecordProps> {
const id = action.payload.id ? action.payload.id : state.cellFocused;
if (!id) {
return state;
}
const { cellType, source } = action.payload;
const cell = cellType === "markdown" ? emptyMarkdownCell : emptyCodeCell;
const cellId = uuid();
return state.update("notebook", (notebook: ImmutableNotebook) => {
const index = notebook.get("cellOrder", List()).indexOf(id) + 1;
return insertCellAt(
notebook,
(cell as ImmutableMarkdownCell).set("source", source),
cellId,
index
);
});
}
开发者ID:nteract,项目名称:nteract,代码行数:22,代码来源:notebook.ts
示例4: merge
mergeMap(data => {
const session = uuid();
const kernel = Object.assign({}, data.response, {
channel: kernels.connect(
config,
data.response.id,
session
)
});
kernel.channel.next(kernelInfoRequest());
return merge(
of(
actions.activateKernelFulfilled({
serverId,
kernelName,
kernel
})
)
);
})
开发者ID:nteract,项目名称:play,代码行数:22,代码来源:epics.ts
示例5: handleSendNewMessageAction
function handleSendNewMessageAction(state: StoreData, action: SendNewMessageAction) {
// using cloneDeep for copying the object properties if they are objects
//const newStoreState = _.cloneDeep(state);
// since the state has no nested objects, we will use shallow copy
const newStoreState: StoreData= {
participants: state.participants,
// shallow copy (a new object reference that points to the current object)
// because we are not gonna mutate the whole map but just one thread
threads: Object.assign({}, state.threads),
messages: Object.assign({}, state.messages)
};
// shallow copy of the previous version of the current thread to mutate the message ids array because both of then are frozen
newStoreState.threads[action.payload.threadId] = Object.assign({}, state.threads[action.payload.threadId]);
// then assign the copy to a variable
const currentThread = newStoreState.threads[action.payload.threadId];
const newMessage: Message = {
text: action.payload.text,
threadId: action.payload.threadId,
timestamp: new Date().getTime(),
participantId: action.payload.participantId,
id: uuid()
};
// linking the thread to the messages
// then copy the message ids array into new array
// because it's still pointing to a previously existing frozen array because it's immutable
currentThread.messageIds = currentThread.messageIds.slice(0);
// then push the new message id into it
currentThread.messageIds.push(newMessage.id);
// save the message by using the newStoreState instead of using state to prevent mutating the store state directly
newStoreState.messages[newMessage.id] = newMessage;
return newStoreState;
}
开发者ID:MidoShahin,项目名称:Chat-App-using-ngrx-store,代码行数:39,代码来源:uiStoreDataReducer.ts
示例6: getStableHelmVersion
async function getStableHelmVersion() : Promise<string>{
var downloadPath = path.join(getTempDirectory(), uuidV4() +".json");
var options = {
hostname: 'api.github.com',
port: 443,
path: '/repos/kubernetes/helm/releases/latest',
method: 'GET',
secureProtocol: "TLSv1_2_method",
headers: {
'User-Agent' : 'vsts'
}
}
try{
await downloadutility.download(options, downloadPath, true);
var version = await getReleaseVersion(downloadPath);
return version;
} catch(error) {
tl.warning(tl.loc("HelmLatestNotKnown", helmLatestReleaseUrl, error, stableHelmVersion));
}
return stableHelmVersion;
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:23,代码来源:helminstaller.ts
示例7: async
export const createSockets = async (
config: JupyterConnectionInfo,
subscription: string = "",
identity = uuid(),
jmp = moduleJMP
) => {
const [shell, control, stdin, iopub] = await Promise.all([
createSocket("shell", identity, config, jmp),
createSocket("control", identity, config, jmp),
createSocket("stdin", identity, config, jmp),
createSocket("iopub", identity, config, jmp)
]);
// NOTE: ZMQ PUB/SUB subscription (not an Rx subscription)
iopub.subscribe(subscription);
return {
shell,
control,
stdin,
iopub
};
};
开发者ID:nteract,项目名称:nteract,代码行数:23,代码来源:index.ts
示例8: focusNextCell
function focusNextCell(
state: NotebookModel,
action: actionTypes.FocusNextCell
): RecordOf<DocumentRecordProps> {
const cellOrder = state.getIn(["notebook", "cellOrder"]);
const id = action.payload.id ? action.payload.id : state.get("cellFocused");
// If for some reason we neither have an ID here or a focused cell, we just
// keep the state consistent
if (!id) {
return state;
}
const curIndex = cellOrder.findIndex((foundId: CellId) => id === foundId);
const curCellType = state.getIn(["notebook", "cellMap", id, "cell_type"]);
const nextIndex = curIndex + 1;
// When at the end, create a new cell
if (nextIndex >= cellOrder.size) {
if (!action.payload.createCellIfUndefined) {
return state;
}
const cellId: string = uuid();
const cell = curCellType === "code" ? emptyCodeCell : emptyMarkdownCell;
const notebook: ImmutableNotebook = state.get("notebook");
return state
.set("cellFocused", cellId)
.set("notebook", insertCellAt(notebook, cell, cellId, nextIndex));
}
// When in the middle of the notebook document, move to the next cell
return state.set("cellFocused", cellOrder.get(nextIndex));
}
开发者ID:nteract,项目名称:nteract,代码行数:37,代码来源:notebook.ts
示例9: createCellBefore
function createCellBefore(
state: NotebookModel,
action: actionTypes.CreateCellBefore
) {
console.log(
"DEPRECATION WARNING: This function is being deprecated. Please use createCellAbove() instead"
);
const id = action.payload.id ? action.payload.id : state.cellFocused;
if (!id) {
return state;
}
const { cellType } = action.payload;
const cell = cellType === "markdown" ? emptyMarkdownCell : emptyCodeCell;
const cellId = uuid();
return state.update("notebook", (notebook: ImmutableNotebook) => {
const cellOrder: Immutable.List<CellId> = notebook.get(
"cellOrder",
Immutable.List()
);
const index = cellOrder.indexOf(id);
return insertCellAt(notebook, cell, cellId, index);
});
}
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:24,代码来源:notebook.ts
示例10: knex
export async function save({
sceneId,
name,
description,
createdBy,
enabled = true,
}: {
sceneId: string;
name: string;
description: string;
createdBy: string;
enabled?: boolean;
}): Promise<string> {
const aliasId = uuidv4();
await knex(TABLE).insert({
aliasId,
sceneId,
description,
name,
enabled,
createdBy,
});
return aliasId;
}
开发者ID:7h1b0,项目名称:Anna,代码行数:24,代码来源:alias.ts
注:本文中的uuid/v4.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论