Skip to content

Commit

Permalink
js(nostr-sdk): add shutdown_on_drop(true) in JsClientBuilder::build
Browse files Browse the repository at this point in the history
Consume `ClientBuilder` after `buil` method call
  • Loading branch information
yukibtc committed Jan 22, 2024
1 parent d8f762e commit b10196c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bindings/nostr-sdk-js/src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ impl JsClientBuilder {
self.inner.opts(opts.deref().clone()).into()
}

/// Build [`Client`]
pub fn build(&self) -> JsClient {
Client::from_builder(self.inner.clone()).into()
/// Build `Client`
///
/// This method **consume** the `ClientBuilder`!
pub fn build(mut self) -> JsClient {
self.inner.opts = self.inner.opts.shutdown_on_drop(true);
Client::from_builder(self.inner).into()
}
}

0 comments on commit b10196c

Please sign in to comment.