本文整理匯總了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();
}