@eleven-am/pondsocket 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/pondBase/baseClass.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export interface Resolver {
|
|
|
8
8
|
|
|
9
9
|
export declare class BaseClass {
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @desc checks if the pattern is matchable
|
|
13
|
+
* @param pattern - the pattern to check
|
|
14
|
+
*/
|
|
15
|
+
protected static isPatternMatchable(pattern: string | RegExp): boolean;
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* @desc compares string to string | regex
|
|
13
19
|
* @param string - the string to compare to the pattern
|
|
@@ -34,4 +40,14 @@ export declare class BaseClass {
|
|
|
34
40
|
* @param obj2 - the second object
|
|
35
41
|
*/
|
|
36
42
|
areEqual<T>(obj1: T, obj2: T): boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @desc Creates an object from the params of a path
|
|
46
|
+
* @param path - the path to create the object from
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* /api/id?name=abc should return { name: 'abc' }
|
|
50
|
+
* /api/id?name=abc&age=123 should return { name: 'abc', age: '123' }
|
|
51
|
+
*/
|
|
52
|
+
protected _parseQueries(path: string): default_t<string>;
|
|
37
53
|
}
|
package/pondBase/pubSub.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export declare class Broadcast<T, A> {
|
|
|
10
10
|
*/
|
|
11
11
|
subscribe(handler: (data: T) => A): Subscription;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @desc Gets the number of subscribers
|
|
15
|
+
*/
|
|
16
|
+
public get subscriberCount(): number;
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* @desc Publish to the broadcast
|
|
15
20
|
* @param data - The data to publish
|
package/pondBase/pubSub.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {ResponsePicker} from "../pondBase";
|
|
2
|
-
import {PondMessage, SendResponse
|
|
2
|
+
import {PondMessage, SendResponse} from "./types";
|
|
3
|
+
import {Channel} from "./channel";
|
|
3
4
|
|
|
4
5
|
export declare abstract class PondResponse<T extends ResponsePicker = ResponsePicker.CHANNEL> {
|
|
5
6
|
/**
|
|
@@ -24,15 +25,13 @@ export declare abstract class PondResponse<T extends ResponsePicker = ResponsePi
|
|
|
24
25
|
abstract accept(assigns?: Partial<SendResponse<T>>): void;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export type PondChannelResponseHandler = (assigns: SendResponse, message?: { event: string, payload: PondMessage }) => void;
|
|
28
|
-
|
|
29
28
|
export declare class ChannelResponse extends PondResponse {
|
|
30
29
|
|
|
31
|
-
constructor(
|
|
30
|
+
constructor(clientId: string, channel: Channel, resolver: (hasErrored: boolean) => void);
|
|
32
31
|
|
|
33
|
-
accept(assigns: Partial<SendResponse
|
|
32
|
+
accept(assigns: Partial<SendResponse> | undefined): void;
|
|
34
33
|
|
|
35
34
|
reject(message: string | undefined, errorCode: number | undefined): void;
|
|
36
35
|
|
|
37
|
-
send(event: string, payload: PondMessage, assigns: Partial<SendResponse
|
|
36
|
+
send(event: string, payload: PondMessage, assigns: Partial<SendResponse> | undefined): void;
|
|
38
37
|
}
|