Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/store

Package Overview
Dependencies
Maintainers
5
Versions
1249
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/store - npm Package Compare versions

Comparing version 0.3.0-20221224062401-54874d6 to 0.3.0-20221224075546-5606029

4

dist/providers/indexdb.d.ts

@@ -21,4 +21,4 @@ import * as Y from 'yjs';

_storeTimeout: number;
_storeTimeoutId: any;
_storeUpdate: (update: Uint8Array, origin: any) => void;
_storeTimeoutId: ReturnType<typeof setTimeout> | null;
_storeUpdate: (update: Uint8Array, origin: this) => void;
constructor(name: string, doc: Y.Doc);

@@ -25,0 +25,0 @@ destroy(): Promise<void>;

@@ -10,4 +10,6 @@ import * as Y from 'yjs';

}) => {
const [updatesStore] = idb.transact(
/** @type {IDBDatabase} */ idbPersistence.db, [updatesStoreName]); // , 'readonly')
if (!idbPersistence.db) {
throw new Error('idbPersistence.db is null');
}
const [updatesStore] = idb.transact(idbPersistence.db, [updatesStoreName]); // , 'readonly')
return idb

@@ -14,0 +16,0 @@ .getAll(updatesStore, idb.createIDBKeyRangeLowerBound(idbPersistence._dbref, false))

export interface Disposable {
dispose(): void;
}
export declare function flattenDisposable(a: Disposable[]): Disposable;
declare type DisposeLogic = Disposable | (() => void);
export declare class DisposableGroup implements Disposable {
private _disposables;
private _disposed;
get disposed(): boolean;
constructor(_disposables?: DisposeLogic[]);
/**
* Add to group to be disposed with others.
*
* This will be immediately disposed if this group has already been disposed.
*/
add(disposable: DisposeLogic | undefined | null | false): void;
dispose(): void;
}
export declare function flattenDisposable(disposables: Disposable[]): Disposable;
export {};
//# sourceMappingURL=disposable.d.ts.map

@@ -1,16 +0,51 @@

export function flattenDisposable(a) {
export class DisposableGroup {
constructor(_disposables = []) {
this._disposables = _disposables;
this._disposed = false;
}
get disposed() {
return this._disposed;
}
/**
* Add to group to be disposed with others.
*
* This will be immediately disposed if this group has already been disposed.
*/
add(disposable) {
if (disposable) {
if (this._disposed)
execDisposeLogic(disposable);
else
this._disposables.push(disposable);
}
}
dispose() {
disposeAllAndClearArray(this._disposables);
this._disposed = true;
}
}
export function flattenDisposable(disposables) {
return {
dispose: () => {
a.forEach(d => {
try {
d.dispose();
}
catch (err) {
console.error(err);
}
});
a.length = 0;
},
dispose: disposeAllAndClearArray.bind(null, disposables),
};
}
/** @internal */
function disposeAllAndClearArray(disposables) {
for (const disposable of disposables) {
try {
execDisposeLogic(disposable);
}
catch (err) {
console.error(err);
}
}
disposables.length = 0;
}
/** @internal */
function execDisposeLogic(disposable) {
if (typeof disposable === 'function')
disposable();
else
disposable.dispose();
}
//# sourceMappingURL=disposable.js.map

@@ -6,3 +6,4 @@ import { Disposable } from './disposable.js';

private disposables;
static fromEvent<N extends keyof HTMLElementEventMap>(element: HTMLElement | Window, eventName: N, eventOptions?: boolean | AddEventListenerOptions): Signal<HTMLElementEventMap[N]>;
static fromEvent<N extends keyof WindowEventMap>(element: Window, eventName: N, options?: boolean | AddEventListenerOptions): Signal<WindowEventMap[N]>;
static fromEvent<N extends keyof HTMLElementEventMap>(element: HTMLElement, eventName: N, eventOptions?: boolean | AddEventListenerOptions): Signal<HTMLElementEventMap[N]>;
filter(testFun: (v: T) => boolean): Signal<T>;

@@ -9,0 +10,0 @@ on(callback: (v: T) => unknown): Disposable;

{
"name": "@blocksuite/store",
"version": "0.3.0-20221224062401-54874d6",
"version": "0.3.0-20221224075546-5606029",
"description": "BlockSuite data store built for general purpose state management.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -16,6 +16,6 @@ import * as Y from 'yjs';

) => {
const [updatesStore] = idb.transact(
/** @type {IDBDatabase} */ idbPersistence.db!,
[updatesStoreName]
); // , 'readonly')
if (!idbPersistence.db) {
throw new Error('idbPersistence.db is null');
}
const [updatesStore] = idb.transact(idbPersistence.db, [updatesStoreName]); // , 'readonly')
return idb

@@ -89,4 +89,4 @@ .getAll(

_storeTimeoutId: any;
_storeUpdate: (update: Uint8Array, origin: any) => void;
_storeTimeoutId: ReturnType<typeof setTimeout> | null;
_storeUpdate: (update: Uint8Array, origin: this) => void;
constructor(name: string, doc: Y.Doc) {

@@ -93,0 +93,0 @@ super();

@@ -5,15 +5,49 @@ export interface Disposable {

export function flattenDisposable(a: Disposable[]): Disposable {
type DisposeLogic = Disposable | (() => void);
export class DisposableGroup implements Disposable {
private _disposed = false;
get disposed() {
return this._disposed;
}
constructor(private _disposables: DisposeLogic[] = []) {}
/**
* Add to group to be disposed with others.
*
* This will be immediately disposed if this group has already been disposed.
*/
add(disposable: DisposeLogic | undefined | null | false): void {
if (disposable) {
if (this._disposed) execDisposeLogic(disposable);
else this._disposables.push(disposable);
}
}
dispose(): void {
disposeAllAndClearArray(this._disposables);
this._disposed = true;
}
}
export function flattenDisposable(disposables: Disposable[]): Disposable {
return {
dispose: () => {
a.forEach(d => {
try {
d.dispose();
} catch (err) {
console.error(err);
}
});
a.length = 0;
},
dispose: disposeAllAndClearArray.bind(null, disposables),
};
}
/** @internal */
function disposeAllAndClearArray(disposables: DisposeLogic[]) {
for (const disposable of disposables) {
try {
execDisposeLogic(disposable);
} catch (err) {
console.error(err);
}
}
disposables.length = 0;
}
/** @internal */
function execDisposeLogic(disposable: DisposeLogic) {
if (typeof disposable === 'function') disposable();
else disposable.dispose();
}

@@ -9,4 +9,13 @@ import { Disposable, flattenDisposable } from './disposable.js';

private disposables: Disposable[] = [];
static fromEvent<N extends keyof WindowEventMap>(
element: Window,
eventName: N,
options?: boolean | AddEventListenerOptions
): Signal<WindowEventMap[N]>;
static fromEvent<N extends keyof HTMLElementEventMap>(
element: HTMLElement,
eventName: N,
eventOptions?: boolean | AddEventListenerOptions
): Signal<HTMLElementEventMap[N]>;
static fromEvent<N extends keyof HTMLElementEventMap>(
element: HTMLElement | Window,

@@ -13,0 +22,0 @@ eventName: N,

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc