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


TypeScript JSONExt.deepCopy方法代碼示例

本文整理匯總了TypeScript中@phosphor/coreutils.JSONExt.deepCopy方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript JSONExt.deepCopy方法的具體用法?TypeScript JSONExt.deepCopy怎麽用?TypeScript JSONExt.deepCopy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@phosphor/coreutils.JSONExt的用法示例。


在下文中一共展示了JSONExt.deepCopy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should be emitted when the specs change', async () => {
   const specs = JSONExt.deepCopy(KERNELSPECS) as Kernel.ISpecModels;
   specs.default = 'shell';
   handleRequest(manager, 200, specs);
   let called = false;
   manager.specsChanged.connect((sender, args) => {
     expect(sender).to.equal(manager);
     expect(args.default).to.equal(specs.default);
     called = true;
   });
   await manager.refreshSpecs();
   expect(called).to.equal(true);
 });
開發者ID:alexmorley,項目名稱:jupyterlab,代碼行數:13,代碼來源:manager.spec.ts

示例2: toJSON

  /**
   * Serialize the model to JSON.
   */
  toJSON(): JSONObject {
    const out: JSONObject = Object.create(null);
    const keys = this.keys();

    for (let key of keys) {
      const value = this.get(key);

      if (value !== undefined) {
        out[key] = JSONExt.deepCopy(value);
      }
    }
    return out;
  }
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:16,代碼來源:observablejson.ts

示例3: populate

      fetch: plugin => {
        // Only override the canonical schema the first time.
        if (!canonical) {
          canonical = JSONExt.deepCopy(plugin.schema);
          populate(canonical);
        }

        return {
          data: plugin.data,
          id: plugin.id,
          raw: plugin.raw,
          schema: canonical,
          version: plugin.version
        };
      }
開發者ID:AlbertHilb,項目名稱:jupyterlab,代碼行數:15,代碼來源:index.ts

示例4: ajaxSettingsWithToken

function ajaxSettingsWithToken(ajaxSettings?: IAjaxSettings, token?: string): IAjaxSettings {
  if (!ajaxSettings) {
    ajaxSettings = {};
  } else {
    ajaxSettings = JSONExt.deepCopy(ajaxSettings);
  }
  if (!token) {
    token = PageConfig.getOption('token');
  }
  if (!token || token === '') {
    return ajaxSettings;
  }
  if (!ajaxSettings.requestHeaders) {
    ajaxSettings.requestHeaders = {};
  }
  ajaxSettings.requestHeaders['Authorization'] = `token ${token}`;
  return ajaxSettings;
}
開發者ID:eskirk,項目名稱:jupyterlab,代碼行數:18,代碼來源:utils.ts


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