本文整理汇总了TypeScript中aerial-common2.generateDefaultId函数的典型用法代码示例。如果您正苦于以下问题:TypeScript generateDefaultId函数的具体用法?TypeScript generateDefaultId怎么用?TypeScript generateDefaultId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generateDefaultId函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: openSyntheticWindowEnvironment
function* openSyntheticWindowEnvironment({ $id: windowId = generateDefaultId(), location, bounds, scrollPosition }: SyntheticWindow, browserId: string) {
let main: SEnvWindowInterface;
const documentId = generateDefaultId();
const fetch = yield getFetch();
const { apiHost }: SyntheticBrowserRootState = yield select();
let currentWindow: SEnvWindowInterface;
const reloadChan = yield eventChannel((emit) => {
const reload = (bounds?: Bounds) => {
if (currentWindow) {
currentWindow.dispose();
}
const SEnvWindow = getSEnvWindowClass({
console: getSEnvWindowConsole(),
fetch,
reload: () => reload(),
getProxyUrl: (url: string) => {
return apiHost && url.substr(0, 5) !== "data:" && url.indexOf(window.location.host) === -1 ? apiHost + "/proxy/" + encodeURIComponent(url) : url;
},
createRenderer: (window: SEnvWindowInterface) => {
return window.top === window ? new SyntheticMirrorRenderer(window) : new SyntheticDOMRenderer(window, document)
}
});
const window = currentWindow = new SEnvWindow(location, browserId);
// ick. Better to use seed function instead to generate UIDs <- TODO.
window.$id = windowId;
window.document.$id = documentId;
if (bounds) {
window.moveTo(bounds.left, bounds.top);
if (bounds.right) {
window.resizeTo(bounds.right - bounds.left, bounds.bottom - bounds.top);
}
}
emit(window);
return window;
};
reload(bounds);
return () => { };
});
yield spawn(function*() {
while(true) {
yield watchWindowExternalResourceUris(currentWindow, () => currentWindow.location.reload());
currentWindow.$load();
const isNew = !getSyntheticWindow(yield select(), currentWindow.$id);
yield put(syntheticWindowOpened(currentWindow, null, isNew));
yield take(reloadChan);
}
});
}
示例2: generateDefaultId
export const mutateSourceContentRequest = (content: string, contentType: string, mutation: Mutation<any>): MutateSourceContentRequest<any> => ({
content,
mutation,
contentType,
$id: generateDefaultId(),
type: EDIT_SOURCE_CONTENT,
});
示例3: constructor
constructor() {
super();
this.$id = generateDefaultId();
this.childNodes = this.childNodesArray = new SEnvNodeList();
// called specifically for elements
if (this._constructed) {
throw new Error(`Cannot call constructor twice.`);
}
this._constructed = true;
this.addEventListener(SEnvMutationEvent.MUTATION, this._onMutation.bind(this));
}
示例4: constructor
constructor() {
this._$id = generateDefaultId();
}