当前位置: 首页>>代码示例>>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;未经允许,请勿转载。