Skip to content

Commit

Permalink
return static properties to all builds
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Sep 11, 2023
1 parent 05c0ac4 commit 0f5bcb4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "centrifuge",
"version": "5.0.0-beta.2",
"version": "5.0.0-beta.3",
"description": "JavaScript client SDK for bidirectional communication with Centrifugo and Centrifuge-based server from browser, NodeJS and React Native",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
12 changes: 1 addition & 11 deletions src/browser.protobuf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@
* This file is the entrypoint of browser builds.
* The code executes when loaded in a browser.
*/
import { Centrifuge, UnauthorizedError } from './centrifuge';
import { Centrifuge } from './centrifuge';
import { ProtobufCodec } from './protobuf.codec';
import {
State, SubscriptionState,
} from './types';

// @ts-ignore – required for browser build.
Centrifuge.SubscriptionState = SubscriptionState;
// @ts-ignore – need for browser build.
Centrifuge.State = State
// @ts-ignore – need for browser build.
Centrifuge.UnauthorizedError = UnauthorizedError;

export default class CentrifugeProtobuf extends Centrifuge {
protected _formatOverride() {
Expand Down
12 changes: 1 addition & 11 deletions src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
/**
* This file is the entrypoint of browser builds.
*/
import { Centrifuge, UnauthorizedError } from './centrifuge'
import {
State, SubscriptionState,
} from './types';

// @ts-ignore – need for browser build.
Centrifuge.SubscriptionState = SubscriptionState;
// @ts-ignore – need for browser build.
Centrifuge.State = State
// @ts-ignore – need for browser build.
Centrifuge.UnauthorizedError = UnauthorizedError;
import { Centrifuge } from './centrifuge'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).Centrifuge = Centrifuge
8 changes: 8 additions & 0 deletions src/centrifuge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export class Centrifuge extends (EventEmitter as new () => TypedEventEmitter<Cli
private _config: Options;
protected _codec: any;

static SubscriptionState: typeof SubscriptionState;
static State: typeof State;
static UnauthorizedError: typeof UnauthorizedError;

/** Constructs Centrifuge client. Call connect() method to start connecting. */
constructor(endpoint: string | Array<TransportEndpoint>, options?: Partial<Options>) {
super();
Expand Down Expand Up @@ -1833,3 +1837,7 @@ export class Centrifuge extends (EventEmitter as new () => TypedEventEmitter<Cli
}
}
}

Centrifuge.SubscriptionState = SubscriptionState;
Centrifuge.State = State
Centrifuge.UnauthorizedError = UnauthorizedError;

0 comments on commit 0f5bcb4

Please sign in to comment.