Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"test:watch": "eslint --fix && jest --updateSnapshot --watchAll"
},
"types": "dist/index.d.ts",
"version": "1.1.0-alpha.16",
"version": "1.1.0-alpha.17",
"dependencies": {
"@webkrafters/eagleeye": "^1.0.8",
"js-sha512": "^0.9.0",
Expand Down
28 changes: 3 additions & 25 deletions src/main/universe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,18 @@ class StreamerHandle<W extends Channel> implements Handle<W> {
return this._entry?.channel?.deref?.() as W
}
// istanbul ignore next
get size() { return this.isValid ? this._entry.numConnections : 0 }
get size() { return this.isValid ? this._entry.numConnections : -1 }
// istanbul ignore next
dec() {
if( !this.isValid ) { return }
this._entry.numConnections--;
if( this.size ) { return }
this.resource.endStream();
this._chs.finalizer.unregister( this.resource );
const { channel } = this._entry;
this._entry.channel = null;
this._chs.finalize( this._sMapHash );
setTimeout( () => channel.deref()?.endStream(), 0 );
}
inc() { this.isValid && this._entry.numConnections++ }
}
Expand Down Expand Up @@ -461,27 +463,3 @@ export class Utility<T extends State> {
}

export function createContext<T extends State>() { return new ObservableUniverse<T>() }

{/* function _makeStore<
T extends State,
S extends SelectorMap
>( channel : Channel<T, S> ) {
const s = makeStore( channel );
s.resetState = intercept( s.resetState );
s.setState = intercept( s.setState );
return s;
} */}

// function intercept( m : IStore["resetState"] );
// function intercept( m : IStore["setState"] );
// function intercept( m : any ) {
// return ( ...args : Parameters<typeof m> ) => {
// try { m( ...args ) } catch( e ) {
// /* istanbul ignore next */
// if( !e.message.startsWith( "Cannot read properties of null (reading 'getState')" ) ) {
// throw e;
// }
// // allow system gc to clean up scheduled freed streams
// }
// }
// }
Loading