@jupyterlab/services
Advanced tools
Comparing version 0.30.2 to 0.31.0
@@ -77,8 +77,11 @@ import { IDisposable } from 'phosphor/lib/core/disposable'; | ||
/** | ||
* The cached kernel spec. | ||
* Test whether the kernel is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* Get the kernel spec. | ||
* | ||
* #### Notes | ||
* This value will be null until the kernel is ready. | ||
* @returns A promise that resolves with the kernel spec. | ||
*/ | ||
readonly spec: Kernel.ISpecModel | null; | ||
spec(): Promise<Kernel.ISpecModel>; | ||
/** | ||
@@ -353,4 +356,2 @@ * A promise that is fulfilled when the kernel is ready. | ||
private _connectionPromise; | ||
private _readyPromise; | ||
private _spec; | ||
} | ||
@@ -357,0 +358,0 @@ /** |
@@ -31,3 +31,2 @@ // Copyright (c) Jupyter Development Team. | ||
function DefaultKernel(options, id) { | ||
var _this = this; | ||
this._id = ''; | ||
@@ -62,6 +61,2 @@ this._name = ''; | ||
this._comms = new Map(); | ||
this._readyPromise = Private.findSpecs(options).then(function (specs) { | ||
_this._spec = specs.kernelspecs[_this._name]; | ||
return _this._connectionPromise.promise; | ||
}); | ||
this._createSocket(); | ||
@@ -179,11 +174,8 @@ Private.runningKernels.pushBack(this); | ||
}); | ||
Object.defineProperty(DefaultKernel.prototype, "spec", { | ||
Object.defineProperty(DefaultKernel.prototype, "isReady", { | ||
/** | ||
* The cached kernel spec. | ||
* | ||
* #### Notes | ||
* This value will be null until the kernel is ready. | ||
* Test whether the kernel is ready. | ||
*/ | ||
get: function () { | ||
return this._spec; | ||
return this._isReady; | ||
}, | ||
@@ -194,6 +186,21 @@ enumerable: true, | ||
/** | ||
* Get the kernel spec. | ||
* | ||
* @returns A promise that resolves with the kernel spec. | ||
*/ | ||
DefaultKernel.prototype.spec = function () { | ||
var _this = this; | ||
var options = { | ||
baseUrl: this._baseUrl, | ||
ajaxSettings: this.ajaxSettings | ||
}; | ||
return Private.findSpecs(options).then(function (specs) { | ||
return specs.kernelspecs[_this._name]; | ||
}); | ||
}; | ||
/** | ||
* A promise that is fulfilled when the kernel is ready. | ||
*/ | ||
DefaultKernel.prototype.ready = function () { | ||
return this._readyPromise; | ||
return this._connectionPromise.promise; | ||
}; | ||
@@ -1099,2 +1106,3 @@ /** | ||
validate.validateModel(success.data); | ||
options = utils.copy(options); | ||
options.name = success.data.name; | ||
@@ -1128,2 +1136,4 @@ return new DefaultKernel(options, success.data.id); | ||
return getKernelModel(id, options).then(function (model) { | ||
options = utils.copy(options); | ||
options.name = model.name; | ||
return new DefaultKernel(options, id); | ||
@@ -1130,0 +1140,0 @@ }).catch(function () { |
@@ -78,8 +78,5 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* The cached kernel spec. | ||
* | ||
* #### Notes | ||
* This value will be null until the kernel is ready. | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly spec: Kernel.ISpecModel | null; | ||
readonly isReady: boolean; | ||
/** | ||
@@ -90,2 +87,8 @@ * A promise that is fulfilled when the kernel is initially ready. | ||
/** | ||
* Get the kernel spec. | ||
* | ||
* @returns A promise that resolves with the kernel spec. | ||
*/ | ||
spec(): Promise<Kernel.ISpecModel>; | ||
/** | ||
* Send a shell message to the kernel. | ||
@@ -466,2 +469,6 @@ * | ||
/** | ||
* A promise that is fulfilled when the kernel is initially ready. | ||
*/ | ||
ready(): Promise<void>; | ||
/** | ||
* A promise that fulfills when the manager is initially ready. | ||
@@ -468,0 +475,0 @@ */ |
@@ -51,2 +51,6 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that fulfills when the manager is ready. | ||
@@ -130,2 +134,3 @@ */ | ||
private _readyPromise; | ||
private _isReady; | ||
} |
@@ -29,2 +29,3 @@ // Copyright (c) Jupyter Development Team. | ||
this._specsTimer = -1; | ||
this._isReady = false; | ||
this._baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
@@ -115,2 +116,12 @@ this._wsUrl = options.wsUrl || utils.getWsUrl(this._baseUrl); | ||
}); | ||
Object.defineProperty(KernelManager.prototype, "isReady", { | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
get: function () { | ||
return this._isReady; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -212,2 +223,3 @@ * A promise that fulfills when the manager is ready. | ||
return kernel_1.Kernel.listRunning(this._getOptions({})).then(function (running) { | ||
_this._isReady = true; | ||
if (!json_1.deepEqual(running, _this._running)) { | ||
@@ -214,0 +226,0 @@ _this._running = running.slice(); |
@@ -50,2 +50,6 @@ import { JSONObject } from 'phosphor/lib/algorithm/json'; | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that fulfills when the manager is ready. | ||
@@ -93,2 +97,6 @@ */ | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that fulfills when the manager is initially ready. | ||
@@ -95,0 +103,0 @@ */ |
@@ -109,2 +109,12 @@ // Copyright (c) Jupyter Development Team. | ||
}); | ||
Object.defineProperty(ServiceManager.prototype, "isReady", { | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
get: function () { | ||
return this._sessionManager.isReady || this._terminalManager.isReady; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -111,0 +121,0 @@ * A promise that fulfills when the manager is ready. |
@@ -52,2 +52,6 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that fulfills when the manager is ready. | ||
@@ -54,0 +58,0 @@ */ |
@@ -114,2 +114,12 @@ // Copyright (c) Jupyter Development Team. | ||
}); | ||
Object.defineProperty(SessionManager.prototype, "isReady", { | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
get: function () { | ||
return this._specs !== null; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -116,0 +126,0 @@ * A promise that fulfills when the manager is ready. |
@@ -293,2 +293,6 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that is fulfilled when the manager is ready. | ||
@@ -295,0 +299,0 @@ */ |
@@ -40,2 +40,6 @@ import { ISignal } from 'phosphor/lib/core/signaling'; | ||
/** | ||
* Test whether the session is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* Test whether the session is disposed. | ||
@@ -72,2 +76,3 @@ */ | ||
private _readyPromise; | ||
private _isReady; | ||
} | ||
@@ -74,0 +79,0 @@ /** |
@@ -23,2 +23,3 @@ // Copyright (c) Jupyter Development Team. | ||
this._isDisposed = false; | ||
this._isReady = false; | ||
this._name = name; | ||
@@ -76,2 +77,12 @@ this._baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
}); | ||
Object.defineProperty(DefaultTerminalSession.prototype, "isReady", { | ||
/** | ||
* Test whether the session is ready. | ||
*/ | ||
get: function () { | ||
return this._isReady; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DefaultTerminalSession.prototype, "isDisposed", { | ||
@@ -113,5 +124,13 @@ /** | ||
DefaultTerminalSession.prototype.send = function (message) { | ||
var _this = this; | ||
var msg = [message.type]; | ||
msg.push.apply(msg, message.content); | ||
this._ws.send(JSON.stringify(msg)); | ||
var value = JSON.stringify(msg); | ||
if (this._isReady) { | ||
this._ws.send(value); | ||
return; | ||
} | ||
this.ready().then(function () { | ||
_this._ws.send(value); | ||
}); | ||
}; | ||
@@ -152,2 +171,3 @@ /** | ||
_this._ws.onopen = function (event) { | ||
_this._isReady = true; | ||
resolve(void 0); | ||
@@ -249,3 +269,3 @@ }; | ||
iteration_1.each(Object.keys(Private.running), function (runningUrl) { | ||
if (urls.indexOf(runningUrl) !== -1) { | ||
if (urls.indexOf(runningUrl) === -1) { | ||
var session = Private.running[runningUrl]; | ||
@@ -252,0 +272,0 @@ session.terminated.emit(void 0); |
@@ -38,2 +38,6 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Test whether the manger is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* Dispose of the resources used by the manager. | ||
@@ -94,2 +98,3 @@ */ | ||
private _isDisposed; | ||
private _isReady; | ||
private _refreshTimer; | ||
@@ -96,0 +101,0 @@ private _readyPromise; |
@@ -24,2 +24,3 @@ // Copyright (c) Jupyter Development Team. | ||
this._isDisposed = false; | ||
this._isReady = false; | ||
this._refreshTimer = -1; | ||
@@ -82,2 +83,12 @@ this._baseUrl = options.baseUrl || utils.getBaseUrl(); | ||
}); | ||
Object.defineProperty(TerminalManager.prototype, "isReady", { | ||
/** | ||
* Test whether the manger is ready. | ||
*/ | ||
get: function () { | ||
return this._isReady; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -167,2 +178,3 @@ * Dispose of the resources used by the manager. | ||
return terminal_1.TerminalSession.listRunning(this._getOptions({})).then(function (running) { | ||
_this._isReady = true; | ||
if (!json_1.deepEqual(running, _this._running)) { | ||
@@ -169,0 +181,0 @@ _this._running = running.slice(); |
@@ -40,2 +40,6 @@ import { IIterator } from 'phosphor/lib/algorithm/iteration'; | ||
/** | ||
* Test whether the session is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that fulfills when the session is initially ready. | ||
@@ -148,2 +152,6 @@ */ | ||
/** | ||
* Test whether the manager is ready. | ||
*/ | ||
readonly isReady: boolean; | ||
/** | ||
* A promise that fulfills when the manager is ready. | ||
@@ -150,0 +158,0 @@ */ |
{ | ||
"name": "@jupyterlab/services", | ||
"version": "0.30.2", | ||
"version": "0.31.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
708787
20805