浏览代码

Add setOption to pageconfig module

Luc Bouchard 7 年之前
父节点
当前提交
1dbbd3a028
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      packages/coreutils/src/pageconfig.ts

+ 15 - 0
packages/coreutils/src/pageconfig.ts

@@ -82,6 +82,21 @@ namespace PageConfig {
     }
     return configData[name] || '';
   }
+  
+  /**
+   * Set global configuration data for the Jupyter application.
+   *
+   * @param name - The name of the configuration option.
+   * @param value - The value to set the option to.
+   *
+   * @returns The last config value or an empty string if it doesn't exist.
+   */
+  export
+  function setOption(name: string, value: string): string {
+    let last = getOption(value);
+    configData[name] = value;
+    return last;
+  }
 
   /**
    * Get the base url for a Jupyter application.