@@ -79,45 +79,42 @@ impl EditorHandle {
7979 }
8080}
8181
82- #[ cfg( not( feature = "native" ) ) ]
83- #[ wasm_bindgen( js_name = constructEditor) ]
84- pub fn construct_editor ( platform : String , uuid_random_seed : u64 , frontend_message_handler_callback : js_sys:: Function ) -> EditorHandle {
85- Editor :: init (
86- Environment {
87- platform : Platform :: Web ,
88- host : match platform. as_str ( ) {
89- "Linux" => Host :: Linux ,
90- "Mac" => Host :: Mac ,
91- "Windows" => Host :: Windows ,
92- _ => unreachable ! ( ) ,
82+ #[ wasm_bindgen]
83+ impl EditorHandle {
84+ #[ cfg( not( feature = "native" ) ) ]
85+ pub fn create ( platform : String , uuid_random_seed : u64 , frontend_message_handler_callback : js_sys:: Function ) -> EditorHandle {
86+ let editor = Editor :: create (
87+ Environment {
88+ platform : Platform :: Web ,
89+ host : match platform. as_str ( ) {
90+ "Linux" => Host :: Linux ,
91+ "Mac" => Host :: Mac ,
92+ "Windows" => Host :: Windows ,
93+ _ => unreachable ! ( ) ,
94+ } ,
9395 } ,
94- } ,
95- uuid_random_seed,
96- ) ;
96+ uuid_random_seed,
97+ ) ;
9798
98- let editor = Editor :: new ( ) ;
99- let editor_handle = EditorHandle { frontend_message_handler_callback } ;
100- if EDITOR . with ( |handle| handle. lock ( ) . ok ( ) . map ( |mut guard| * guard = Some ( editor) ) ) . is_none ( ) {
101- log:: error!( "Attempted to initialize the editor more than once" ) ;
102- }
103- if EDITOR_HANDLE . with ( |handle| handle. lock ( ) . ok ( ) . map ( |mut guard| * guard = Some ( editor_handle. clone ( ) ) ) ) . is_none ( ) {
104- log:: error!( "Attempted to initialize the editor handle more than once" ) ;
99+ let editor_handle = EditorHandle { frontend_message_handler_callback } ;
100+ if EDITOR . with ( |handle| handle. lock ( ) . ok ( ) . map ( |mut guard| * guard = Some ( editor) ) ) . is_none ( ) {
101+ log:: error!( "Attempted to initialize the editor more than once" ) ;
102+ }
103+ if EDITOR_HANDLE . with ( |handle| handle. lock ( ) . ok ( ) . map ( |mut guard| * guard = Some ( editor_handle. clone ( ) ) ) ) . is_none ( ) {
104+ log:: error!( "Attempted to initialize the editor handle more than once" ) ;
105+ }
106+ editor_handle
105107 }
106- editor_handle
107- }
108108
109- #[ cfg( feature = "native" ) ]
110- #[ wasm_bindgen( js_name = constructEditor) ]
111- pub fn construct_editor ( _platform : String , _uuid_random_seed : u64 , frontend_message_handler_callback : js_sys:: Function ) -> EditorHandle {
112- let editor_handle = EditorHandle { frontend_message_handler_callback } ;
113- if EDITOR_HANDLE . with ( |handle| handle. lock ( ) . ok ( ) . map ( |mut guard| * guard = Some ( editor_handle. clone ( ) ) ) ) . is_none ( ) {
114- log:: error!( "Attempted to initialize the editor handle more than once" ) ;
109+ #[ cfg( feature = "native" ) ]
110+ pub fn create ( _platform : String , _uuid_random_seed : u64 , frontend_message_handler_callback : js_sys:: Function ) -> EditorHandle {
111+ let editor_handle = EditorHandle { frontend_message_handler_callback } ;
112+ if EDITOR_HANDLE . with ( |handle| handle. lock ( ) . ok ( ) . map ( |mut guard| * guard = Some ( editor_handle. clone ( ) ) ) ) . is_none ( ) {
113+ log:: error!( "Attempted to initialize the editor handle more than once" ) ;
114+ }
115+ editor_handle
115116 }
116- editor_handle
117- }
118117
119- #[ wasm_bindgen]
120- impl EditorHandle {
121118 // Sends a message to the dispatcher in the Editor Backend
122119 #[ cfg( not( feature = "native" ) ) ]
123120 fn dispatch < T : Into < Message > > ( & self , message : T ) {
0 commit comments