浏览代码

Simplify setting manager definition.

Afshin Darian 7 年之前
父节点
当前提交
4f39f2825e
共有 1 个文件被更改,包括 6 次插入29 次删除
  1. 6 29
      packages/services/src/setting/index.ts

+ 6 - 29
packages/services/src/setting/index.ts

@@ -24,7 +24,7 @@ const SERVICE_SETTINGS_URL = 'lab/api/settings';
  * The static namespace for `SettingManager`.
  */
 export
-class SettingManager implements Setting.IManager {
+class SettingManager {
   /**
    * Create a new setting manager.
    */
@@ -43,7 +43,8 @@ class SettingManager implements Setting.IManager {
    *
    * @param id - The plugin's ID.
    *
-   * @returns A promise that resolves with the plugin settings.
+   * @returns A promise that resolves with the plugin settings or rejects
+   * with a `ServerConnection.IError`.
    */
   fetch(id: string): Promise<ISettingRegistry.IPlugin> {
     const base = this.serverSettings.baseUrl;
@@ -69,7 +70,8 @@ class SettingManager implements Setting.IManager {
    *
    * @param user - The plugin's user setting values.
    *
-   * @returns A promise that resolves when saving is complete.
+   * @returns A promise that resolves when saving is complete or rejects
+   * with a `ServerConnection.IError`.
    */
   save(id: string, user: JSONObject): Promise<void> {
     const base = this.serverSettings.baseUrl;
@@ -121,32 +123,7 @@ namespace Setting {
    * The interface for the setting system manager.
    */
   export
-  interface IManager {
-    /**
-     * Fetch a plugin's settings.
-     *
-     * @param id - The plugin's ID.
-     *
-     * @returns A promise that resolves with the plugin settings.
-     */
-    fetch(id: string): Promise<ISettingRegistry.IPlugin>;
-
-    /**
-     * Save a plugin's settings.
-     *
-     * @param id - The plugin's ID.
-     *
-     * @param user - The plugin's user setting values.
-     *
-     * @returns A promise that resolves when saving is complete.
-     */
-    save(id: string, user: JSONObject): Promise<void>;
-
-    /**
-     * The server settings used to make API requests.
-     */
-    readonly serverSettings: ServerConnection.ISettings;
-  }
+  interface IManager extends SettingManager { }
 }