Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc69da7f

Browse files
Revert "BridgeJS: Update examples and documentation for@JS init"
This reverts commited482fe.
1 parentbaf4409 commitc69da7f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎Examples/ExportSwift/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { init } from "./.build/plugins/PackageToJS/outputs/Package/index.js";
22
const{ exports}=awaitinit({});
33

44
constGreeter=exports.Greeter;
5-
constgreeter=Greeter.init("World");
5+
constgreeter=newGreeter("World");
66
constcircle=exports.renderCircleSVG(100);
77

88
// Display the results

‎Examples/PlayBridgeJS/Sources/JavaScript/app.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class BridgeJSPlayground {
5252
createTS2Skeleton:this.createTS2Skeleton
5353
}
5454
});
55-
this.playBridgeJS=exports.PlayBridgeJS.init();
55+
this.playBridgeJS=newexports.PlayBridgeJS();
5656
console.log('BridgeJS initialized successfully');
5757
}catch(error){
5858
console.error('Failed to initialize BridgeJS:',error);
@@ -162,4 +162,4 @@ export class BridgeJSPlayground {
162162
hideError(){
163163
this.errorDisplay.classList.remove('show');
164164
}
165-
}
165+
}

‎Sources/JavaScriptKit/Documentation.docc/Articles/Exporting-Swift-to-JavaScript.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ In #"diff-c82eee18ce9b73c4bdde0a1aff6a34427b9e1ac5a4628e0bad177ca69e9e9b80-133-133-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">133
133
import {init }from"./.build/plugins/PackageToJS/outputs/Package/index.js";
134134
const { exports }=awaitinit({});
135135

136-
const cart=exports.ShoppingCart.init();
136+
const cart=newexports.ShoppingCart();
137137
cart.addItem("Laptop",999.99,1);
138138
cart.addItem("Mouse",24.99,2);
139139
console.log(`Items in cart: ${cart.getItemCount()}`);
@@ -158,7 +158,7 @@ export interface ShoppingCart extends SwiftHeapObject {
158158

159159
exporttypeExports= {
160160
ShoppingCart: {
161-
init():ShoppingCart;
161+
new():ShoppingCart;
162162
}
163163
}
164164
```
@@ -175,8 +175,8 @@ You can export functions to specific namespaces by providing a namespace paramet
175175
importJavaScriptKit
176176

177177
// Export a function to a custom namespace
178-
@JS(namespace:"MyModule.Utils")funcnamespacedFunction() ->String {
179-
return"namespaced"
178+
@JS(namespace:"MyModule.Utils")funcnamespacedFunction() ->String {
179+
return"namespaced"
180180
}
181181
```
182182

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp