You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to make a version of the pubsub async iterator that throws an error if the pushQueue goes over a certain size. Right now it is difficult to extend the existing pubsub async iterator to add this because most things are set to private and cannot be accessed by an overriding class.
Right now I am having to do this:
classMaxQueuePubSubAsyncIterator<T>extendsPubSubAsyncIterator<T>{constructor(pubsub: PubSubEngine,eventNames: string|string[]){super(pubsub,eventNames)// pushValue and pushQueue are private so this is a hack to access/override them.constsuper_pushValue=this["pushValue"]as((event:T)=>Promise<void>)this["pushValue"]=async(event: T)=>{if((this["pushQueue"]asT[]).length>=MAX_QUEUE){thrownewMaxQueueError('Maximum Queue Size Reached')}returnawaitsuper_pushValue(event)}}}
However if pushValue and pushQueue were marked as protected instead of private, they would still be inaccessible in normal usage but could be accessed from extending classes and simplify this code quite a bit:
I am trying to make a version of the pubsub async iterator that throws an error if the pushQueue goes over a certain size. Right now it is difficult to extend the existing pubsub async iterator to add this because most things are set to private and cannot be accessed by an overriding class.
Right now I am having to do this:
However if
pushValue
andpushQueue
were marked as protected instead of private, they would still be inaccessible in normal usage but could be accessed from extending classes and simplify this code quite a bit:The text was updated successfully, but these errors were encountered: