Skip to content

Commit

Permalink
pre-review cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Dec 12, 2023
1 parent 5fabcc7 commit bfa7828
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/**
* A format to describe a variable available to be read from the server. Application fields are optional, and only
* populated when a variable is provided by application mode.
*
* APIs which take a VariableDefinition` must at least be provided an object with a <b>type</b> and <b>id</b> field.
* <p>
* APIs which take a VariableDefinition must at least be provided an object with a <b>type</b> and <b>id</b> field.
*/
@TsInterface
@TsName(namespace = "dh.ide", name = "VariableDefinition")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ public String getDataAsString() {
return new String(Js.uncheckedCast(response.getData().getPayload_asU8()), StandardCharsets.UTF_8);
}

/**
* @return the exported objects sent in the initial message from the server. The client is responsible for closing
* them when finished using them.
*/
@Override
@JsProperty
public JsWidgetExportedObject[] getExportedObjects() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.vertispan.tsdefs.annotations.TsInterface;
import com.vertispan.tsdefs.annotations.TsName;
import elemental2.core.JsArray;
import elemental2.promise.Promise;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.session_pb.ExportRequest;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.ExportedTableCreationResponse;
Expand All @@ -19,10 +20,13 @@
import io.deephaven.web.client.api.console.JsVariableType;
import io.deephaven.web.client.state.ClientTableState;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsNullable;
import jsinterop.annotations.JsProperty;

/**
* Represents a server-side object that may not yet have been fetched by the client.
* Represents a server-side object that may not yet have been fetched by the client. When this object will no longer be
* used, if {@link #fetch()} is not called on this object, then {@link #close()} must be to ensure server-side resources
* are correctly freed.
*/
@TsInterface
@TsName(namespace = "dh", name = "WidgetExportedObject")
Expand Down Expand Up @@ -58,8 +62,19 @@ public JsWidgetExportedObject(WorkerConnection connection, TypedTicket ticket) {
});
}

/**
* Returns the type of this export, typically one of {@link JsVariableType}, but may also include plugin types. If
* null, this object cannot be fetched, but can be passed to the server, such as via
* {@link JsWidget#sendMessage(JsWidget.MessageUnion, JsArray)}.
*
* @return the string type of this server-side object, or null.
*/
@JsNullable
@JsProperty
public String getType() {
if (ticket.getType().isEmpty()) {
return null;
}
return ticket.getType();
}

Expand Down Expand Up @@ -93,17 +108,6 @@ public Promise<JsWidgetExportedObject> reexport() {
});
}


// Could also return Promise<JsWidgetExportedObject> - perhaps if we make it have a `boolean refetch` arg?
// /**
// * Returns a copy of this widget, so that any later {@link #fetch()} will always return a fresh instance.
// * @return
// */
// @JsMethod
// public JsWidgetExportedObject copy() {
// return new JsWidgetExportedObject(connection, ticket);
// }

/**
* Returns a promise that will fetch the object represented by this reference. Multiple calls to this will return
* the same instance.
Expand Down

0 comments on commit bfa7828

Please sign in to comment.