Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change webln enable to void #2599

Merged
merged 6 commits into from
Aug 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/extension/providers/webln/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,21 @@ type KeysendArgs = {

export default class WebLNProvider {
enabled: boolean;
isEnabled: boolean;
executing: boolean;
private _eventEmitter: EventEmitter;

constructor() {
this.enabled = false;
this.isEnabled = false; // seems some webln implementations use webln.isEnabled and some use webln.enabled
this.executing = false;
this._eventEmitter = new EventEmitter();
}

async enable() {
async enable(): Promise<void> {
if (this.enabled) {
return { enabled: true };
return;
}
const result = await this.execute("enable");
if (typeof result.enabled === "boolean") {
this.enabled = result.enabled;
this.isEnabled = result.enabled;
}
return result;
}

getInfo() {
Expand Down