@lvce-editor/opener-worker 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -981,6 +981,7 @@ const createMockRpc = ({
981
981
  const Electron = 2;
982
982
 
983
983
  const RendererWorker = 1;
984
+ const SharedProcess = 1492;
984
985
 
985
986
  const rpcs = Object.create(null);
986
987
  const set$2 = (id, rpc) => {
@@ -1031,10 +1032,13 @@ const create = rpcId => {
1031
1032
  };
1032
1033
 
1033
1034
  const {
1034
- invoke: invoke$1,
1035
+ invoke: invoke$2,
1035
1036
  set: set$1
1036
1037
  } = create(RendererWorker);
1037
1038
 
1039
+ const {
1040
+ invoke: invoke$1} = create(SharedProcess);
1041
+
1038
1042
  const handleMessagePort = async (port, rpcId) => {
1039
1043
  const rpc = await PlainMessagePortRpcParent.create({
1040
1044
  commandMap: {},
@@ -1046,7 +1050,7 @@ const handleMessagePort = async (port, rpcId) => {
1046
1050
  };
1047
1051
 
1048
1052
  const openNew = async url => {
1049
- // TODO
1053
+ await invoke$1('OpenExternal.openExternal', url);
1050
1054
  };
1051
1055
 
1052
1056
  let enabled = false;
@@ -1081,29 +1085,27 @@ const OpenExternal = {
1081
1085
  openExternal: openExternal$1
1082
1086
  };
1083
1087
 
1084
- const platform = 0;
1085
-
1086
1088
  const openUrlWeb = async url => {
1087
1089
  try {
1088
1090
  // TODO make platform argument required
1089
- await invoke$1('Open.openUrl', url);
1091
+ await invoke$2('Open.openUrl', url);
1090
1092
  } catch (error) {
1091
1093
  throw new VError(error, `Failed to open url ${url}`);
1092
1094
  }
1093
1095
  };
1094
1096
  const openUrlElectron = async url => {
1095
- await openNew();
1097
+ await openNew(url);
1096
1098
  };
1097
1099
 
1098
1100
  // TODO add required platform argument
1099
- const openUrl = async url => {
1101
+ const openUrl = async (url, platform) => {
1100
1102
  if (get()) {
1101
1103
  writeUrl(url);
1102
1104
  return;
1103
1105
  }
1104
1106
  switch (platform) {
1105
1107
  case Electron:
1106
- return openUrlElectron();
1108
+ return openUrlElectron(url);
1107
1109
  default:
1108
1110
  return openUrlWeb(url);
1109
1111
  }
@@ -1127,13 +1129,17 @@ const commandMap = {
1127
1129
  'Open.readOpenedUrl': readOpenedMemory
1128
1130
  };
1129
1131
 
1130
- const listen = async () => {
1132
+ const initializeRendererWorker = async () => {
1131
1133
  const rpc = await WebWorkerRpcClient.create({
1132
1134
  commandMap: commandMap
1133
1135
  });
1134
1136
  set$1(rpc);
1135
1137
  };
1136
1138
 
1139
+ const listen = async () => {
1140
+ await initializeRendererWorker();
1141
+ };
1142
+
1137
1143
  const main = async () => {
1138
1144
  await listen();
1139
1145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/opener-worker",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Opener Worker",
5
5
  "repository": {
6
6
  "type": "git",