@supabase/realtime-js
Advanced tools
Comparing version 1.8.0-next.3 to 1.8.0-next.4
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.8.0-next.3"; | ||
export declare const version = "1.8.0-next.4"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '1.8.0-next.3'; | ||
exports.version = '1.8.0-next.4'; | ||
//# sourceMappingURL=version.js.map |
@@ -24,10 +24,2 @@ import { CHANNEL_EVENTS, CHANNEL_STATES } from './lib/constants'; | ||
list(): any[]; | ||
track(payload: { | ||
[key: string]: any; | ||
}, opts?: { | ||
[key: string]: any; | ||
}): Promise<Push>; | ||
untrack(opts?: { | ||
[key: string]: any; | ||
}): Promise<Push>; | ||
rejoinUntilConnected(): void; | ||
@@ -83,3 +75,3 @@ subscribe(timeout?: number): Push; | ||
[key: string]: any; | ||
}): Push; | ||
}): Promise<'ok' | 'timeout'>; | ||
replyEventName(ref: string): string; | ||
@@ -86,0 +78,0 @@ isClosed(): boolean; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -63,2 +54,21 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
this.presence = new RealtimePresence_1.default(this); | ||
this.presence.onJoin((key, currentPresences, newPresences) => { | ||
this.trigger('presence', { | ||
event: 'join', | ||
key, | ||
currentPresences, | ||
newPresences, | ||
}); | ||
}); | ||
this.presence.onLeave((key, currentPresences, leftPresences) => { | ||
this.trigger('presence', { | ||
event: 'leave', | ||
key, | ||
currentPresences, | ||
leftPresences, | ||
}); | ||
}); | ||
this.presence.onSync(() => { | ||
this.trigger('presence', { event: 'sync' }); | ||
}); | ||
} | ||
@@ -68,19 +78,2 @@ list() { | ||
} | ||
track(payload, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.send({ | ||
type: 'presence', | ||
event: 'track', | ||
payload, | ||
}, opts); | ||
}); | ||
} | ||
untrack(opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.send({ | ||
type: 'presence', | ||
event: 'untrack', | ||
}, opts); | ||
}); | ||
} | ||
rejoinUntilConnected() { | ||
@@ -236,3 +229,8 @@ this.rejoinTimer.scheduleTimeout(); | ||
var _a; | ||
return this.push(payload.type, payload, (_a = opts.timeout) !== null && _a !== void 0 ? _a : this.timeout); | ||
const push = this.push(payload.type, payload, (_a = opts.timeout) !== null && _a !== void 0 ? _a : this.timeout); | ||
return new Promise((resolve) => { | ||
push | ||
.receive('ok', () => resolve('ok')) | ||
.receive('timeout', () => resolve('timeout')); | ||
}); | ||
} | ||
@@ -239,0 +237,0 @@ replyEventName(ref) { |
@@ -234,21 +234,2 @@ "use strict"; | ||
const chan = new RealtimeChannel_1.default(topic, params, this); | ||
chan.presence.onJoin((key, currentPresences, newPresences) => { | ||
chan.trigger('presence', { | ||
event: 'join', | ||
key, | ||
currentPresences, | ||
newPresences, | ||
}); | ||
}); | ||
chan.presence.onLeave((key, currentPresences, leftPresences) => { | ||
chan.trigger('presence', { | ||
event: 'leave', | ||
key, | ||
currentPresences, | ||
leftPresences, | ||
}); | ||
}); | ||
chan.presence.onSync(() => { | ||
chan.trigger('presence', { event: 'sync' }); | ||
}); | ||
this.channels.push(chan); | ||
@@ -255,0 +236,0 @@ return chan; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.8.0-next.3"; | ||
export declare const version = "1.8.0-next.4"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = '1.8.0-next.3'; | ||
export const version = '1.8.0-next.4'; | ||
//# sourceMappingURL=version.js.map |
@@ -24,10 +24,2 @@ import { CHANNEL_EVENTS, CHANNEL_STATES } from './lib/constants'; | ||
list(): any[]; | ||
track(payload: { | ||
[key: string]: any; | ||
}, opts?: { | ||
[key: string]: any; | ||
}): Promise<Push>; | ||
untrack(opts?: { | ||
[key: string]: any; | ||
}): Promise<Push>; | ||
rejoinUntilConnected(): void; | ||
@@ -83,3 +75,3 @@ subscribe(timeout?: number): Push; | ||
[key: string]: any; | ||
}): Push; | ||
}): Promise<'ok' | 'timeout'>; | ||
replyEventName(ref: string): string; | ||
@@ -86,0 +78,0 @@ isClosed(): boolean; |
@@ -1,10 +0,1 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
import { CHANNEL_EVENTS, CHANNEL_STATES } from './lib/constants'; | ||
@@ -58,2 +49,21 @@ import Push from './lib/push'; | ||
this.presence = new RealtimePresence(this); | ||
this.presence.onJoin((key, currentPresences, newPresences) => { | ||
this.trigger('presence', { | ||
event: 'join', | ||
key, | ||
currentPresences, | ||
newPresences, | ||
}); | ||
}); | ||
this.presence.onLeave((key, currentPresences, leftPresences) => { | ||
this.trigger('presence', { | ||
event: 'leave', | ||
key, | ||
currentPresences, | ||
leftPresences, | ||
}); | ||
}); | ||
this.presence.onSync(() => { | ||
this.trigger('presence', { event: 'sync' }); | ||
}); | ||
} | ||
@@ -63,19 +73,2 @@ list() { | ||
} | ||
track(payload, opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.send({ | ||
type: 'presence', | ||
event: 'track', | ||
payload, | ||
}, opts); | ||
}); | ||
} | ||
untrack(opts = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.send({ | ||
type: 'presence', | ||
event: 'untrack', | ||
}, opts); | ||
}); | ||
} | ||
rejoinUntilConnected() { | ||
@@ -231,3 +224,8 @@ this.rejoinTimer.scheduleTimeout(); | ||
var _a; | ||
return this.push(payload.type, payload, (_a = opts.timeout) !== null && _a !== void 0 ? _a : this.timeout); | ||
const push = this.push(payload.type, payload, (_a = opts.timeout) !== null && _a !== void 0 ? _a : this.timeout); | ||
return new Promise((resolve) => { | ||
push | ||
.receive('ok', () => resolve('ok')) | ||
.receive('timeout', () => resolve('timeout')); | ||
}); | ||
} | ||
@@ -234,0 +232,0 @@ replyEventName(ref) { |
@@ -229,21 +229,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const chan = new RealtimeChannel(topic, params, this); | ||
chan.presence.onJoin((key, currentPresences, newPresences) => { | ||
chan.trigger('presence', { | ||
event: 'join', | ||
key, | ||
currentPresences, | ||
newPresences, | ||
}); | ||
}); | ||
chan.presence.onLeave((key, currentPresences, leftPresences) => { | ||
chan.trigger('presence', { | ||
event: 'leave', | ||
key, | ||
currentPresences, | ||
leftPresences, | ||
}); | ||
}); | ||
chan.presence.onSync(() => { | ||
chan.trigger('presence', { event: 'sync' }); | ||
}); | ||
this.channels.push(chan); | ||
@@ -250,0 +231,0 @@ return chan; |
{ | ||
"name": "@supabase/realtime-js", | ||
"version": "1.8.0-next.3", | ||
"version": "1.8.0-next.4", | ||
"description": "Listen to realtime updates to your PostgreSQL database", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,1 +0,1 @@ | ||
export const version = '1.8.0-next.3' | ||
export const version = '1.8.0-next.4' |
@@ -64,3 +64,23 @@ import { CHANNEL_EVENTS, CHANNEL_STATES } from './lib/constants' | ||
}) | ||
this.presence = new RealtimePresence(this) | ||
this.presence.onJoin((key, currentPresences, newPresences) => { | ||
this.trigger('presence', { | ||
event: 'join', | ||
key, | ||
currentPresences, | ||
newPresences, | ||
}) | ||
}) | ||
this.presence.onLeave((key, currentPresences, leftPresences) => { | ||
this.trigger('presence', { | ||
event: 'leave', | ||
key, | ||
currentPresences, | ||
leftPresences, | ||
}) | ||
}) | ||
this.presence.onSync(() => { | ||
this.trigger('presence', { event: 'sync' }) | ||
}) | ||
} | ||
@@ -72,26 +92,2 @@ | ||
async track( | ||
payload: { [key: string]: any }, | ||
opts: { [key: string]: any } = {} | ||
) { | ||
return await this.send( | ||
{ | ||
type: 'presence', | ||
event: 'track', | ||
payload, | ||
}, | ||
opts | ||
) | ||
} | ||
async untrack(opts: { [key: string]: any } = {}) { | ||
return await this.send( | ||
{ | ||
type: 'presence', | ||
event: 'untrack', | ||
}, | ||
opts | ||
) | ||
} | ||
rejoinUntilConnected() { | ||
@@ -275,4 +271,14 @@ this.rejoinTimer.scheduleTimeout() | ||
opts: { [key: string]: any } = {} | ||
): Push { | ||
return this.push(payload.type as any, payload, opts.timeout ?? this.timeout) | ||
): Promise<'ok' | 'timeout'> { | ||
const push = this.push( | ||
payload.type as any, | ||
payload, | ||
opts.timeout ?? this.timeout | ||
) | ||
return new Promise((resolve) => { | ||
push | ||
.receive('ok', () => resolve('ok')) | ||
.receive('timeout', () => resolve('timeout')) | ||
}) | ||
} | ||
@@ -279,0 +285,0 @@ |
@@ -273,25 +273,4 @@ import { w3cwebsocket } from 'websocket' | ||
chan.presence.onJoin((key, currentPresences, newPresences) => { | ||
chan.trigger('presence', { | ||
event: 'join', | ||
key, | ||
currentPresences, | ||
newPresences, | ||
}) | ||
}) | ||
this.channels.push(chan) | ||
chan.presence.onLeave((key, currentPresences, leftPresences) => { | ||
chan.trigger('presence', { | ||
event: 'leave', | ||
key, | ||
currentPresences, | ||
leftPresences, | ||
}) | ||
}) | ||
chan.presence.onSync(() => { | ||
chan.trigger('presence', { event: 'sync' }) | ||
}) | ||
this.channels.push(chan) | ||
return chan | ||
@@ -298,0 +277,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
282549
5140