當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript aerial-common2.generateDefaultId函數代碼示例

本文整理匯總了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);
    }
  });
}
開發者ID:cryptobuks,項目名稱:tandem,代碼行數:59,代碼來源:synthetic-browser.ts

示例2: generateDefaultId

export const mutateSourceContentRequest = (content: string, contentType: string, mutation: Mutation<any>): MutateSourceContentRequest<any> => ({
  content,
  mutation,
  contentType,
  $id: generateDefaultId(),
  type: EDIT_SOURCE_CONTENT,
});
開發者ID:cryptobuks,項目名稱:tandem,代碼行數:7,代碼來源:index.ts

示例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));
    }
開發者ID:cryptobuks,項目名稱:tandem,代碼行數:12,代碼來源:node.ts

示例4: constructor

 constructor() {
   this._$id = generateDefaultId();
 }
開發者ID:cryptobuks,項目名稱:tandem,代碼行數:3,代碼來源:base.ts


注:本文中的aerial-common2.generateDefaultId函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。