@jupyterlab/services
Advanced tools
Comparing version 0.28.0 to 0.29.0
@@ -461,7 +461,5 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Get the kernel specs. | ||
* | ||
* @returns A promise that resolves with the most recently fecthed specs. | ||
* Get the most recently fetched kernel specs. | ||
*/ | ||
specs(): Promise<ISpecModels>; | ||
readonly specs: Kernel.ISpecModels | null; | ||
/** | ||
@@ -474,11 +472,7 @@ * Create an iterator over the known running kernels. | ||
/** | ||
* Force an update of the available kernel specs. | ||
* Fetch the specs from the server. | ||
* | ||
* @returns A promise that resolves with the kernel spec models. | ||
* | ||
* #### Notes | ||
* This is only meant to be called by the user if the kernel specs | ||
* are known to have changed on disk. | ||
*/ | ||
updateSpecs(): Promise<ISpecModels>; | ||
fetchSpecs(): Promise<ISpecModels>; | ||
/** | ||
@@ -485,0 +479,0 @@ * Force a refresh of the running kernels. |
@@ -47,7 +47,5 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Get the kernel specs. | ||
* | ||
* @returns A promise that resolves with the most recently fetched specs. | ||
* Get the most recently fetched kernel specs. | ||
*/ | ||
specs(): Promise<Kernel.ISpecModels>; | ||
readonly specs: Kernel.ISpecModels | null; | ||
/** | ||
@@ -60,11 +58,7 @@ * Create an iterator over the most recent running kernels. | ||
/** | ||
* Force an update of the available kernel specs. | ||
* Fetch the specs from the server. | ||
* | ||
* @returns A promise that resolves with the kernel spec models. | ||
* | ||
* #### Notes | ||
* This is only meant to be called by the user if the kernel specs | ||
* are known to have changed on disk. | ||
*/ | ||
updateSpecs(): Promise<Kernel.ISpecModels>; | ||
fetchSpecs(): Promise<Kernel.ISpecModels>; | ||
/** | ||
@@ -129,2 +123,3 @@ * Force a refresh of the running kernels. | ||
private _specPromise; | ||
private _runningPromise; | ||
} |
@@ -28,2 +28,4 @@ // Copyright (c) Jupyter Development Team. | ||
this._refreshTimer = -1; | ||
this._specPromise = null; | ||
this._runningPromise = null; | ||
this._baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
@@ -94,17 +96,13 @@ this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl); | ||
}); | ||
Object.defineProperty(KernelManager.prototype, "specs", { | ||
/** | ||
* Get the most recently fetched kernel specs. | ||
*/ | ||
get: function () { | ||
return this._specs; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Get the kernel specs. | ||
* | ||
* @returns A promise that resolves with the most recently fetched specs. | ||
*/ | ||
KernelManager.prototype.specs = function () { | ||
if (this._specs) { | ||
return Promise.resolve(this._specs); | ||
} | ||
if (this._specPromise) { | ||
return this._specPromise; | ||
} | ||
return this.updateSpecs(); | ||
}; | ||
/** | ||
* Create an iterator over the most recent running kernels. | ||
@@ -118,12 +116,11 @@ * | ||
/** | ||
* Force an update of the available kernel specs. | ||
* Fetch the specs from the server. | ||
* | ||
* @returns A promise that resolves with the kernel spec models. | ||
* | ||
* #### Notes | ||
* This is only meant to be called by the user if the kernel specs | ||
* are known to have changed on disk. | ||
*/ | ||
KernelManager.prototype.updateSpecs = function () { | ||
KernelManager.prototype.fetchSpecs = function () { | ||
var _this = this; | ||
if (this._specPromise) { | ||
return this._specPromise; | ||
} | ||
var options = { | ||
@@ -136,2 +133,3 @@ baseUrl: this._baseUrl, | ||
_this._specs = specs; | ||
_this._specPromise = null; | ||
_this.specsChanged.emit(specs); | ||
@@ -156,5 +154,9 @@ } | ||
clearTimeout(this._refreshTimer); | ||
return kernel_1.Kernel.listRunning(this._getOptions()).then(function (running) { | ||
if (this._runningPromise) { | ||
return this._runningPromise; | ||
} | ||
var promise = kernel_1.Kernel.listRunning(this._getOptions()).then(function (running) { | ||
if (!json_1.deepEqual(running, _this._running)) { | ||
_this._running = running.slice(); | ||
_this._runningPromise = null; | ||
_this.runningChanged.emit(running); | ||
@@ -167,2 +169,4 @@ } | ||
}); | ||
this._runningPromise = promise; | ||
return promise; | ||
}; | ||
@@ -169,0 +173,0 @@ /** |
@@ -33,8 +33,2 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Get the kernel specs. | ||
* | ||
* @returns A promise that resolves with the most recently fetched specs. | ||
*/ | ||
specs(): Promise<Kernel.ISpecModels>; | ||
/** | ||
* The base url of the manager. | ||
@@ -55,2 +49,6 @@ */ | ||
/** | ||
* Get the most recently fetched kernel specs. | ||
*/ | ||
readonly specs: Kernel.ISpecModels | null; | ||
/** | ||
* Create an iterator over the most recent running sessions. | ||
@@ -62,11 +60,7 @@ * | ||
/** | ||
* Force an update of the available kernel specs. | ||
* Fetch the specs from the server. | ||
* | ||
* @returns A promise that resolves with the kernel spec models. | ||
* | ||
* #### Notes | ||
* This is only meant to be called by the user if the kernel specs | ||
* are known to have changed on disk. | ||
*/ | ||
updateSpecs(): Promise<Kernel.ISpecModels>; | ||
fetchSpecs(): Promise<Kernel.ISpecModels>; | ||
/** | ||
@@ -119,2 +113,3 @@ * Force a refresh of the running sessions. | ||
private _specPromise; | ||
private _runningPromise; | ||
} |
@@ -29,2 +29,4 @@ // Copyright (c) Jupyter Development Team. | ||
this._refreshTimer = -1; | ||
this._specPromise = null; | ||
this._runningPromise = null; | ||
this._baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
@@ -58,16 +60,2 @@ this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl); | ||
}; | ||
/** | ||
* Get the kernel specs. | ||
* | ||
* @returns A promise that resolves with the most recently fetched specs. | ||
*/ | ||
SessionManager.prototype.specs = function () { | ||
if (this._specs) { | ||
return Promise.resolve(this._specs); | ||
} | ||
if (this._specPromise) { | ||
return this._specPromise; | ||
} | ||
return this.updateSpecs(); | ||
}; | ||
Object.defineProperty(SessionManager.prototype, "baseUrl", { | ||
@@ -109,2 +97,12 @@ /** | ||
}); | ||
Object.defineProperty(SessionManager.prototype, "specs", { | ||
/** | ||
* Get the most recently fetched kernel specs. | ||
*/ | ||
get: function () { | ||
return this._specs; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -119,12 +117,11 @@ * Create an iterator over the most recent running sessions. | ||
/** | ||
* Force an update of the available kernel specs. | ||
* Fetch the specs from the server. | ||
* | ||
* @returns A promise that resolves with the kernel spec models. | ||
* | ||
* #### Notes | ||
* This is only meant to be called by the user if the kernel specs | ||
* are known to have changed on disk. | ||
*/ | ||
SessionManager.prototype.updateSpecs = function () { | ||
SessionManager.prototype.fetchSpecs = function () { | ||
var _this = this; | ||
if (this._specPromise) { | ||
return this._specPromise; | ||
} | ||
var options = { | ||
@@ -137,2 +134,3 @@ baseUrl: this._baseUrl, | ||
_this._specs = specs; | ||
_this._specPromise = null; | ||
_this.specsChanged.emit(specs); | ||
@@ -157,5 +155,9 @@ } | ||
clearTimeout(this._refreshTimer); | ||
return session_1.Session.listRunning(this._getOptions({})).then(function (running) { | ||
if (this._runningPromise) { | ||
return this._runningPromise; | ||
} | ||
var promise = session_1.Session.listRunning(this._getOptions({})).then(function (running) { | ||
if (!json_1.deepEqual(running, _this._running)) { | ||
_this._running = running.slice(); | ||
_this._runningPromise = null; | ||
_this.runningChanged.emit(running); | ||
@@ -172,2 +174,4 @@ } | ||
}); | ||
this._runningPromise = promise; | ||
return promise; | ||
}; | ||
@@ -174,0 +178,0 @@ /** |
@@ -286,7 +286,5 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Get the kernel specs. | ||
* | ||
* @returns A promise that resolves with the most recently fecthed specs. | ||
* Get the most recently fetched kernel specs. | ||
*/ | ||
specs(): Promise<Kernel.ISpecModels>; | ||
readonly specs: Kernel.ISpecModels | null; | ||
/** | ||
@@ -351,11 +349,7 @@ * Create an iterator over the known running sessions. | ||
/** | ||
* Force an update of the available kernel specs. | ||
* Fetch the specs from the server. | ||
* | ||
* @returns A promise that resolves with the kernel spec models. | ||
* | ||
* #### Notes | ||
* This is only meant to be called by the user if the kernel specs | ||
* are known to have changed on disk. | ||
*/ | ||
updateSpecs(): Promise<Kernel.ISpecModels>; | ||
fetchSpecs(): Promise<Kernel.ISpecModels>; | ||
/** | ||
@@ -362,0 +356,0 @@ * Force a refresh of the running sessions. |
{ | ||
"name": "@jupyterlab/services", | ||
"version": "0.28.0", | ||
"version": "0.29.0", | ||
"description": "Client APIs for the Jupyter services REST APIs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
696561
20350