electrobun 0.6.0-beta.0 → 0.7.1-beta.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.
package/bun.lock CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "lockfileVersion": 1,
3
+ "configVersion": 0,
3
4
  "workspaces": {
4
5
  "": {
5
6
  "name": "electrobun",
@@ -237,7 +237,11 @@ export class BrowserView<T> {
237
237
  | "did-navigate"
238
238
  | "did-navigate-in-page"
239
239
  | "did-commit-navigation"
240
- | "dom-ready",
240
+ | "dom-ready"
241
+ | "download-started"
242
+ | "download-progress"
243
+ | "download-completed"
244
+ | "download-failed",
241
245
  handler
242
246
  ) {
243
247
  const specificName = `${name}-${this.id}`;
@@ -23,4 +23,12 @@ export default {
23
23
  }, {}>("new-window-open", data),
24
24
  hostMessage: (data) =>
25
25
  new ElectrobunEvent<{ detail: string }, {}>("host-message", data),
26
+ downloadStarted: (data) =>
27
+ new ElectrobunEvent<{ detail: string }, {}>("download-started", data),
28
+ downloadProgress: (data) =>
29
+ new ElectrobunEvent<{ detail: string }, {}>("download-progress", data),
30
+ downloadCompleted: (data) =>
31
+ new ElectrobunEvent<{ detail: string }, {}>("download-completed", data),
32
+ downloadFailed: (data) =>
33
+ new ElectrobunEvent<{ detail: string }, {}>("download-failed", data),
26
34
  };
@@ -1097,6 +1097,10 @@ const webviewEventHandler = (id, eventName, detail) => {
1097
1097
  "dom-ready": "domReady",
1098
1098
  "new-window-open": "newWindowOpen",
1099
1099
  "host-message": "hostMessage",
1100
+ "download-started": "downloadStarted",
1101
+ "download-progress": "downloadProgress",
1102
+ "download-completed": "downloadCompleted",
1103
+ "download-failed": "downloadFailed",
1100
1104
  };
1101
1105
 
1102
1106
  // todo: the events map should use the same hyphenated names instead of camelCase
@@ -1108,9 +1112,11 @@ const webviewEventHandler = (id, eventName, detail) => {
1108
1112
  return { success: false };
1109
1113
  }
1110
1114
 
1111
- // Parse JSON data for new-window-open and host-message events
1115
+ // Parse JSON data for events that send JSON
1112
1116
  let parsedDetail = detail;
1113
- if (eventName === "new-window-open" || eventName === "host-message") {
1117
+ if (eventName === "new-window-open" || eventName === "host-message" ||
1118
+ eventName === "download-started" || eventName === "download-progress" ||
1119
+ eventName === "download-completed" || eventName === "download-failed") {
1114
1120
  try {
1115
1121
  parsedDetail = JSON.parse(detail);
1116
1122
  } catch (e) {
@@ -1131,10 +1137,10 @@ const webviewEventHandler = (id, eventName, detail) => {
1131
1137
  result = electrobunEventEmitter.emitEvent(event, id);
1132
1138
  }
1133
1139
 
1134
- const webviewEventJSCallback = new JSCallback((id, _eventName, _detail) => {
1140
+ const webviewEventJSCallback = new JSCallback((id, _eventName, _detail) => {
1135
1141
  let eventName = "";
1136
1142
  let detail = "";
1137
-
1143
+
1138
1144
  try {
1139
1145
  // Convert cstring pointers to actual strings
1140
1146
  eventName = new CString(_eventName).toString();
@@ -1144,7 +1150,7 @@ const webviewEventJSCallback = new JSCallback((id, _eventName, _detail) => {
1144
1150
  console.error('[webviewEventJSCallback] Raw values:', { _eventName, _detail });
1145
1151
  return;
1146
1152
  }
1147
-
1153
+
1148
1154
  webviewEventHandler(id, eventName, detail);
1149
1155
  }, {
1150
1156
  args: [FFIType.u32, FFIType.cstring, FFIType.cstring],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.6.0-beta.0",
3
+ "version": "0.7.1-beta.0",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",