2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-06-27 07:13:12 +00:00
This commit is contained in:
2022-08-27 00:37:58 +03:00
parent 93aeaee315
commit 4fcb5355bc
9 changed files with 87 additions and 18 deletions

View File

@ -133,9 +133,10 @@ export default class DataDeserializer {
static resourceParser(
data, offset, length, connection, requestSequence) {
if (connection != null) {
var id = data.getUint32(offset, requestSequence);
return connection.fetch(id);
return connection.fetch(id, requestSequence);
}
throw Error("Can't parse resource with no connection");
}

View File

@ -1262,7 +1262,7 @@ export default class DistributedConnection extends IStore {
put(resource) {
if (Codec.isLocalResource(resource, this))
this._neededResources.add(resource._p.id, resource);
this._neededResources.add(resource._p.instanceId, resource);
return new AsyncReply(true);
}
@ -2541,7 +2541,7 @@ export default class DistributedConnection extends IStore {
let request = this.resourceRequests.item(id);
if (request != null) {
if (resource != null && (requestSequence?.contains(id) ?? false))
if (resource != null && (requestSequence?.includes(id) ?? false))
return new AsyncReply(resource);
else
return request;

View File

@ -170,14 +170,14 @@ export default class DistributedResource extends IResource
var makeSetter = function(index)
{
return function (value) {
return async function (value) {
if (self._p.destroyed)
throw new Error("Trying to access a destroyed object.");
if (self._p.suspended)
throw new Error("Trying to access a suspended object.");
self._set(index, value);
await self._set(index, value);
};
};
@ -295,6 +295,10 @@ export default class DistributedResource extends IResource
if (index >= this._p.properties.length)
return null;
// Awaiting null is not a problem in JS
if (this._p.properties[index] == value)
return null;
var reply = new AsyncReply();
var parameters = Codec.compose(value, this._p.connection);