@php-wasm/web 0.1.61 → 0.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.
package/.htaccess CHANGED
@@ -1,5 +1 @@
1
1
  AddType application/wasm .wasm
2
-
3
- <FilesMatch "iframe-worker.html$">
4
- Header set Origin-Agent-Cluster: ?1
5
- </FilesMatch>
package/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export declare function consumeAPI<APIType>(remote: Worker | Window): RemoteAPI<
20
20
  export type PublicAPI<Methods, PipedAPI = unknown> = RemoteAPI<Methods & PipedAPI>;
21
21
  export declare function exposeAPI<Methods, PipedAPI>(apiMethods?: Methods, pipedApi?: PipedAPI): [
22
22
  () => void,
23
+ (e: Error) => void,
23
24
  PublicAPI<Methods, PipedAPI>
24
25
  ];
25
26
  export interface PHPResponseData {
@@ -142,7 +143,7 @@ export interface RequestHandler {
142
143
  * }
143
144
  * })
144
145
  * php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
145
- * const result = await php.run({
146
+ * const result = await php.request({
146
147
  * method: "GET",
147
148
  * headers: {
148
149
  * "Content-Type": "text/plain"
@@ -380,7 +381,7 @@ export interface IsomorphicLocalPHP extends RequestHandler {
380
381
  * post_message_to_js(string $data)
381
382
  *
382
383
  * Arguments:
383
- * $data – any extra information as a string
384
+ * $data (string) Data to pass to JavaScript.
384
385
  *
385
386
  * @example
386
387
  *
@@ -787,23 +788,15 @@ export declare function getPHPLoaderModule(version?: SupportedPHPVersion): Promi
787
788
  * mismatched with the actual version, the service worker
788
789
  * will be re-registered.
789
790
  */
790
- export declare function registerServiceWorker<Client extends Remote<WebPHPEndpoint>>(phpApi: Client, scope: string, scriptUrl: string, expectedVersion: string): Promise<void>;
791
+ export declare function registerServiceWorker<Client extends Remote<WebPHPEndpoint>>(phpApi: Client, scope: string, scriptUrl: string): Promise<void>;
791
792
  export declare function parseWorkerStartupOptions<T extends Record<string, string>>(): T;
792
- /**
793
- * Recommended Worker Thread backend.
794
- * It's typically "webworker", but in Firefox it's "iframe"
795
- * because Firefox doesn't support module workers with dynamic imports.
796
- * See https://github.com/mdn/content/issues/24402
797
- */
798
- export declare const recommendedWorkerBackend: string;
799
793
  /**
800
794
  * Spawns a new Worker Thread.
801
795
  *
802
796
  * @param workerUrl The absolute URL of the worker script.
803
- * @param workerBackend The Worker Thread backend to use. Either 'webworker' or 'iframe'.
804
797
  * @param config
805
798
  * @returns The spawned Worker Thread.
806
799
  */
807
- export declare function spawnPHPWorkerThread(workerUrl: string, workerBackend?: "webworker" | "iframe", startupOptions?: Record<string, string>): Promise<Window | Worker>;
800
+ export declare function spawnPHPWorkerThread(workerUrl: string, startupOptions?: Record<string, string>): Promise<Worker>;
808
801
 
809
802
  export {};