当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript preact.render函数代码示例

本文整理汇总了TypeScript中preact.render函数的典型用法代码示例。如果您正苦于以下问题:TypeScript render函数的具体用法?TypeScript render怎么用?TypeScript render使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Promise

 const readyPromise = new Promise((resolve) => {
   const el = h(nb.Notebook, {
     nbId: "default",
     onReady: resolve,
   });
   render(el, document.body);
 });
开发者ID:Befirst-Solutions,项目名称:propel,代码行数:7,代码来源:notebook_test.ts

示例2: async

window.addEventListener("load", async() => {
  render(h(Router, null), document.body, document.body.children[0]);
  await drainExecuteQueue();
  // If we're in a testing environment...
  if (window.navigator.webdriver) {
    // rerender to make sure the dom is up to date and then output a special
    // string which is used in tools/test_browser.js.
    rerender();
    console.log("Propel onload");
  }
});
开发者ID:Befirst-Solutions,项目名称:propel,代码行数:11,代码来源:website_main.ts

示例3: testBrowser

testBrowser(function notebook_NotebookRoot() {
  const mdb = enableMock();
  document.body.innerHTML = "";
  const el = h(nb.NotebookRoot, { });
  render(el, document.body);
  console.log("mdb.counts", mdb.counts);
  assert(objectsEqual(mdb.counts, {
    queryLatest: 1,
  }));
  const c = document.body.children[0];
  assert(c.className === "notebook");
});
开发者ID:Befirst-Solutions,项目名称:propel,代码行数:12,代码来源:notebook_test.ts

示例4: mountJsx

export function mountJsx (
    selector : string,
    ComponentToMount : ComponentFactory<any>,
    additionalProps : object = {},
    context : Document|HTMLElement = document
)
{
    const elements = find(selector, context);

    for (let i = 0; i < elements.length; i++)
    {
        try
        {
            const node = elements[i];

            if (node.parentElement === null)
            {
                console.error("Can't mount on container without parent.");
                continue;
            }

            const content = (node.textContent || "").trim();
            let data = (content !== "")
                ? JSON.parse(content)
                : {};
            data = merge(data, additionalProps);

            render(
                h(ComponentToMount, data),
                node.parentElement,
                node
            );
        }
        catch (e)
        {
            console.error("Could not mount component", e);
        }
    }
}
开发者ID:Becklyn,项目名称:mojave,代码行数:39,代码来源:mount.ts

示例5: loadWebFonts

BROWSER.ready(() => {
  loadWebFonts();

  // Create the main store and register the state to the history object
  const ga = createGoogleAnalytics('UA-12048148-1').sendPageView();
  const sendPageView = ga.sendPageView.bind(ga);
  BROWSER.history.onPopState(sendPageView);
  BROWSER.history.onPushState(sendPageView);

  const fetcher = new FetchStreamer(BROWSER);
  const metafileStore = createMetafileStore(fetcher);

  const metaHolder = BROWSER.query(
    'script[type="application/json"]'
  ) as HTMLElement;
  const metadata = inflate(metaHolder.innerHTML) as
    | MetaFileData
    | MetaFileData[];
  const meta = MetaFile.fromData(metadata);
  console.debug('Infalted meta', meta);

  // Render the main react component
  const pageProps: PageProps = {
    meta,
    metafileStore,
    fetcher,
    gistStore: new GistStore(
      fetcher,
      metafileStore,
      isValidMetaFile(meta) ? meta : null
    ),
    pkg: BROWSER.prop('pkg') as PackageJson
  };
  const el = h(Page, pageProps);
  const root = BROWSER.query('#app');
  render(el, root, root.firstElementChild);
});
开发者ID:valotas,项目名称:valotas.com,代码行数:37,代码来源:main.ts

示例6: disconnectedCallback

 disconnectedCallback() {
   if (super.disconnectedCallback) {
     super.disconnectedCallback();
   }
   render(null, this.renderRoot, mapDom.get(this));
 }
开发者ID:skatejs,项目名称:skatejs,代码行数:6,代码来源:index.ts

示例7: renderer

 renderer() {
   const dom = mapDom.get(this);
   mapDom.set(this, render(this.render(), this.renderRoot, dom));
 }
开发者ID:skatejs,项目名称:skatejs,代码行数:4,代码来源:index.ts

示例8: renderPage

export function renderPage(p: Page): void {
  render(h(p.root, null), document.body, document.body.children[0]);
}
开发者ID:Befirst-Solutions,项目名称:propel,代码行数:3,代码来源:website.ts


注:本文中的preact.render函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。