@tdreyno/pretty-please
Advanced tools
Comparing version 1.0.0-beta.19 to 1.0.0-beta.20
@@ -119,2 +119,5 @@ 'use strict'; | ||
Task.ap = ap; | ||
Task.map2 = map2; | ||
Task.map3 = map3; | ||
Task.map4 = map4; | ||
/** | ||
@@ -519,2 +522,11 @@ * A special form of Task which can be resolved/rejected externally. | ||
} | ||
function map2(fn, taskA, taskB) { | ||
return Task.of(fn).ap(taskA).ap(taskB); | ||
} | ||
function map3(fn, taskA, taskB, taskC) { | ||
return Task.of(fn).ap(taskA).ap(taskB).ap(taskC); | ||
} | ||
function map4(fn, taskA, taskB, taskC, taskD) { | ||
return Task.of(fn).ap(taskA).ap(taskB).ap(taskC).ap(taskD); | ||
} | ||
/** | ||
@@ -573,3 +585,2 @@ * Run a side-effect on success. Useful for logging. | ||
* run that function over the result of a second successful Task. | ||
* @alias mapN | ||
* @param appliedTask The task whose value will be passed to the map function. | ||
@@ -576,0 +587,0 @@ * @param task The task who will return a map function as the success result. |
@@ -76,2 +76,5 @@ // tslint:disable: max-classes-per-file | ||
Task.ap = ap; | ||
Task.map2 = map2; | ||
Task.map3 = map3; | ||
Task.map4 = map4; | ||
/** | ||
@@ -431,2 +434,20 @@ * A special form of Task which can be resolved/rejected externally. | ||
} | ||
export function map2(fn, taskA, taskB) { | ||
return Task.of(fn) | ||
.ap(taskA) | ||
.ap(taskB); | ||
} | ||
export function map3(fn, taskA, taskB, taskC) { | ||
return Task.of(fn) | ||
.ap(taskA) | ||
.ap(taskB) | ||
.ap(taskC); | ||
} | ||
export function map4(fn, taskA, taskB, taskC, taskD) { | ||
return Task.of(fn) | ||
.ap(taskA) | ||
.ap(taskB) | ||
.ap(taskC) | ||
.ap(taskD); | ||
} | ||
/** | ||
@@ -480,3 +501,2 @@ * Run a side-effect on success. Useful for logging. | ||
* run that function over the result of a second successful Task. | ||
* @alias mapN | ||
* @param appliedTask The task whose value will be passed to the map function. | ||
@@ -522,3 +542,2 @@ * @param task The task who will return a map function as the success result. | ||
} | ||
export const mapN = ap; | ||
/** | ||
@@ -525,0 +544,0 @@ * Wait some number of seconds to continue after a successful task. |
@@ -28,2 +28,5 @@ export declare type Reject<E> = (error: E) => void; | ||
static ap: typeof ap; | ||
static map2: typeof map2; | ||
static map3: typeof map3; | ||
static map4: typeof map4; | ||
fork: Fork<E, S>; | ||
@@ -175,2 +178,5 @@ constructor(computation: Fork<E, S>); | ||
export declare function map<E, S, S2>(fn: (result: S) => S2, task: Task<E, S>): Task<E, S2>; | ||
export declare function map2<E, E2, S, S2, S3>(fn: (a: S) => (b: S2) => S3, taskA: Task<E, S>, taskB: Task<E2, S2>): Task<E | E2, S3>; | ||
export declare function map3<E, E2, E3, S, S2, S3, S4>(fn: (a: S) => (b: S2) => (c: S3) => S4, taskA: Task<E, S>, taskB: Task<E2, S2>, taskC: Task<E3, S3>): Task<E | E2 | E3, S4>; | ||
export declare function map4<E, E2, E3, E4, S, S2, S3, S4, S5>(fn: (a: S) => (b: S2) => (c: S3) => (d: S4) => S5, taskA: Task<E, S>, taskB: Task<E2, S2>, taskC: Task<E3, S3>, taskD: Task<E4, S4>): Task<E | E2 | E3 | E4, S5>; | ||
/** | ||
@@ -211,3 +217,2 @@ * Run a side-effect on success. Useful for logging. | ||
* run that function over the result of a second successful Task. | ||
* @alias mapN | ||
* @param appliedTask The task whose value will be passed to the map function. | ||
@@ -217,3 +222,2 @@ * @param task The task who will return a map function as the success result. | ||
export declare function ap<E, S, S2>(task: Task<E, (result: S) => S2>, appliedTask: Task<E, S>): Task<E, S2>; | ||
export declare const mapN: typeof ap; | ||
/** | ||
@@ -220,0 +224,0 @@ * Wait some number of seconds to continue after a successful task. |
@@ -96,2 +96,5 @@ import axios from 'axios'; | ||
Task.ap = ap; | ||
Task.map2 = map2; | ||
Task.map3 = map3; | ||
Task.map4 = map4; | ||
/** | ||
@@ -440,2 +443,20 @@ * A special form of Task which can be resolved/rejected externally. | ||
} | ||
function map2(fn, taskA, taskB) { | ||
return Task.of(fn) | ||
.ap(taskA) | ||
.ap(taskB); | ||
} | ||
function map3(fn, taskA, taskB, taskC) { | ||
return Task.of(fn) | ||
.ap(taskA) | ||
.ap(taskB) | ||
.ap(taskC); | ||
} | ||
function map4(fn, taskA, taskB, taskC, taskD) { | ||
return Task.of(fn) | ||
.ap(taskA) | ||
.ap(taskB) | ||
.ap(taskC) | ||
.ap(taskD); | ||
} | ||
/** | ||
@@ -489,3 +510,2 @@ * Run a side-effect on success. Useful for logging. | ||
* run that function over the result of a second successful Task. | ||
* @alias mapN | ||
* @param appliedTask The task whose value will be passed to the map function. | ||
@@ -492,0 +512,0 @@ * @param task The task who will return a map function as the success result. |
@@ -1,1 +0,1 @@ | ||
import axios from"axios";Object.prototype.andThen=function(fn){return fn(this)};function range(end,start=0){return Array(end-start).fill(undefined).map((_,i)=>start+i)}function to(fn){return(sum,_item,index,all)=>{const isLast=index===all.length-1;if(!isLast){return sum}return fn(all)}}const none=void 0;class Task{constructor(computation){this.fork=computation}andThen(fn){return andThen(fn,this)}succeedIf(fn){return succeedIf(fn,this)}onlyOnce(){return onlyOnce(this)}toPromise(){return toPromise(this)}swap(){return swap(this)}map(fn){return map(fn,this)}tap(fn){return tap(fn,this)}mapError(fn){return mapError(fn,this)}mapBoth(handleError,handleSuccess){return mapBoth(handleError,handleSuccess,this)}fold(handleError,handleSuccess){return fold(handleError,handleSuccess,this)}orElse(fn){return orElse(fn,this)}ap(task){return ap(this,task)}wait(ms){return wait(ms,this)}retryIn(ms){return retryIn(ms,this)}retryWithExponentialBackoff(ms,times){return retryWithExponentialBackoff(ms,times,this)}}Task.fail=fail;Task.succeed=succeed;Task.empty=empty;Task.failIn=failIn;Task.succeedIn=succeedIn;Task.of=succeed;Task.all=all;Task.sequence=sequence;Task.firstSuccess=firstSuccess;Task.never=never;Task.fromPromise=fromPromise;Task.race=race;Task.external=external;Task.emitter=emitter;Task.trySequence=trySequence;Task.none=none;Task.succeedBy=succeedBy;Task.ap=ap;class ExternalTask extends Task{constructor(){super((reject,resolve)=>{switch(this.lastState){case"error":reject(this.alreadyError);case"success":resolve(this.alreadyResult);case"pending":this.computationReject=reject;this.computationResolve=resolve}});this.lastState="pending"}reject(error){this.alreadyError=error;this.lastState="error";if(this.computationReject){this.computationReject(error)}}resolve(result){this.alreadyResult=result;this.lastState="success";if(this.computationResolve){this.computationResolve(result)}}}function external(){return new ExternalTask}function emitter(fn){const task=external();return[task,(...args)=>{try{task.resolve(fn(...args))}catch(e){task.reject(e)}}]}function succeed(result){return new Task((_,resolve)=>resolve(result))}const of=succeed;function succeedBy(result){return new Task((reject,resolve)=>{try{resolve(result())}catch(e){reject(e)}})}function empty(){return of(void 0)}function succeedIn(ms,result){return new Task((_,resolve)=>setTimeout(()=>resolve(result),ms))}function fail(error){return new Task((reject,_)=>reject(error))}function failIn(ms,error){return new Task((reject,_)=>setTimeout(()=>reject(error),ms))}function never(){return new Task(()=>void 0)}function andThen(fn,task){return new Task((reject,resolve)=>task.fork(reject,b=>fn(b).fork(reject,resolve)))}function succeedIf(fn,task){return new Task((reject,resolve)=>{const result=fn();if(result){resolve(result);return}task.fork(reject,resolve)})}function onlyOnce(task){let state="initialized";let cachedResult;let cachedError;let callbackId=0;const callbacks={};function notify(reject,resolve){const id=callbackId++;callbacks[id]={reject:reject,resolve:resolve}}function triggerReject(error){state="failure";cachedError=error;Object.keys(callbacks).forEach(id=>{callbacks[id].reject(error);delete callbacks[id]})}function triggerResolve(result){state="success";cachedResult=result;Object.keys(callbacks).forEach(id=>{callbacks[id].resolve(result);delete callbacks[id]})}return new Task((reject,resolve)=>{switch(state){case"success":resolve(cachedResult);break;case"failure":reject(cachedError);break;case"pending":notify(reject,resolve);break;case"initialized":state="pending";notify(reject,resolve);task.fork(triggerReject,triggerResolve)}})}function fromPromise(maybePromise){if(maybePromise instanceof Promise){return new Task((reject,resolve)=>maybePromise.then(resolve,reject))}return of(maybePromise)}function toPromise(task){return new Promise((resolve,reject)=>task.fork(reject,resolve))}function race(tasks){return new Task((reject,resolve)=>{let done=false;return tasks.map(task=>task.fork(error=>{if(done){return}done=true;reject(error)},result=>{if(done){return}done=true;resolve(result)}))})}class EndOfSequence extends Error{constructor(){super("End of sequence")}}function trySequence(onError,tasks){const[head,...tail]=tasks;if(!head){return fail(new EndOfSequence)}return head.orElse(e=>{const shouldContinue=onError(e);if(shouldContinue===false){return fail(e)}if(shouldContinue===true){return trySequence(onError,tail)}return shouldContinue})}function firstSuccess(tasks){if(tasks.length===0){return fail([])}return new Task((reject,resolve)=>{let isDone=false;let runningTasks=tasks.length;const errors=[];return tasks.map(task=>task.fork(error=>{if(isDone){return}runningTasks-=1;errors.push(error);if(runningTasks===0){reject(errors)}},result=>{if(isDone){return}isDone=true;resolve(result)}))})}function all(tasks){if(tasks.length===0){return of([])}return new Task((reject,resolve)=>{let isDone=false;let runningTasks=tasks.length;const results=[];return tasks.map((task,i)=>task.fork(error=>{if(isDone){return}isDone=true;reject(error)},result=>{if(isDone){return}runningTasks-=1;results[i]=result;if(runningTasks===0){resolve(results)}}))})}function sequence(tasks){if(tasks.length===0){return of([])}return tasks.reduce((sum,task)=>{return andThen(list=>{return map(result=>[...list,result],task)},sum)},succeed([]))}function swap(task){return new Task((reject,resolve)=>task.fork(resolve,reject))}function map(fn,task){return new Task((reject,resolve)=>task.fork(reject,result=>resolve(fn(result))))}function tap(fn,task){return map(result=>{fn(result);return result},task)}function mapError(fn,task){return new Task((reject,resolve)=>task.fork(error=>reject(fn(error)),resolve))}function mapBoth(handleError,handleSuccess,task){return mapError(handleError,map(handleSuccess,task))}function fold(handleError,handleSuccess,task){return new Task((_,resolve)=>task.fork(error=>resolve(handleError(error)),result=>resolve(handleSuccess(result))))}function orElse(fn,task){return new Task((reject,resolve)=>task.fork(error=>fn(error).fork(reject,resolve),resolve))}function ap(task,appliedTask){return new Task((reject,resolve)=>{let targetResult;let applierFunction;let hasResultLoaded=false;let isRejected=false;const handleResolve=onResolve=>{return x=>{if(isRejected){return}onResolve(x);if(applierFunction&&hasResultLoaded){resolve(applierFunction(targetResult))}}};const handleReject=x=>{if(isRejected){return}isRejected=true;reject(x)};task.fork(handleReject,handleResolve(x=>{applierFunction=x}));appliedTask.fork(handleReject,handleResolve(x=>{hasResultLoaded=true;targetResult=x}))})}function wait(ms,task){return new Task((reject,resolve)=>{setTimeout(()=>task.fork(reject,resolve),ms)})}function retryIn(ms,task){return task.orElse(()=>task.wait(ms))}function retryWithExponentialBackoff(ms,times,task){return range(times).reduce((sum,i)=>sum.retryIn(ms*2**i),task)}function get(url,config){return fromPromise(axios.get(url,config))}function delete_(url,config){return fromPromise(axios.delete(url,config))}function head(url,config){return fromPromise(axios.head(url,config))}function post(url,data,config){return fromPromise(axios.post(url,data,config))}function put(url,data,config){return fromPromise(axios.put(url,data,config))}function patch(url,data,config){return fromPromise(axios.patch(url,data,config))}function toJSON(resp){const type=resp.config?resp.config.responseType:"text";switch(type){case"json":return succeed(resp.data);case"text":try{return succeed(JSON.parse(resp.data))}catch(e){return fail(e)}default:return fail(new Error("Invalid data"))}}var HTTP=Object.freeze({__proto__:null,get:get,delete_:delete_,head:head,post:post,put:put,patch:patch,toJSON:toJSON});function initialize(){return{type:"Initialized"}}function pending(){return{type:"Pending"}}function succeed$1(result){return{type:"Success",result:result}}function fail$1(error){return{type:"Failure",error:error}}function fold$1(onInitialized,onPending,onFailure,onSuccess,remote){switch(remote.type){case"Initialized":return onInitialized();case"Pending":return onPending();case"Failure":return onFailure(remote.error);case"Success":return onSuccess(remote.result)}}function fromTask(task){return task.map(succeed$1).orElse(e=>of(fail$1(e)))}var RemoteData=Object.freeze({__proto__:null,initialize:initialize,pending:pending,succeed:succeed$1,fail:fail$1,fold:fold$1,fromTask:fromTask});class Subscription{constructor(){this.eventSubscribers=new Set;this.status="inactive";this.statusSubscribers=new Set}emit(value){return Task.all(Array.from(this.eventSubscribers).map(sub=>sub(value)||Task.empty()))}subscribe(fn){this.eventSubscribers.add(fn);return()=>{this.eventSubscribers.delete(fn);this.checkStatus()}}clear(){this.eventSubscribers.clear();this.checkStatus()}onStatusChange(fn){this.statusSubscribers.add(fn);return()=>this.statusSubscribers.delete(fn)}checkStatus(){const newstatus=this.eventSubscribers.size>0?"active":"inactive";if(newstatus===this.status){return}this.status=newstatus;Array.from(this.statusSubscribers).map(sub=>sub(newstatus))}}export{EndOfSequence,ExternalTask,HTTP,RemoteData,Subscription,Task,range,to}; | ||
import axios from"axios";Object.prototype.andThen=function(fn){return fn(this)};function range(end,start=0){return Array(end-start).fill(undefined).map((_,i)=>start+i)}function to(fn){return(sum,_item,index,all)=>{const isLast=index===all.length-1;if(!isLast){return sum}return fn(all)}}const none=void 0;class Task{constructor(computation){this.fork=computation}andThen(fn){return andThen(fn,this)}succeedIf(fn){return succeedIf(fn,this)}onlyOnce(){return onlyOnce(this)}toPromise(){return toPromise(this)}swap(){return swap(this)}map(fn){return map(fn,this)}tap(fn){return tap(fn,this)}mapError(fn){return mapError(fn,this)}mapBoth(handleError,handleSuccess){return mapBoth(handleError,handleSuccess,this)}fold(handleError,handleSuccess){return fold(handleError,handleSuccess,this)}orElse(fn){return orElse(fn,this)}ap(task){return ap(this,task)}wait(ms){return wait(ms,this)}retryIn(ms){return retryIn(ms,this)}retryWithExponentialBackoff(ms,times){return retryWithExponentialBackoff(ms,times,this)}}Task.fail=fail;Task.succeed=succeed;Task.empty=empty;Task.failIn=failIn;Task.succeedIn=succeedIn;Task.of=succeed;Task.all=all;Task.sequence=sequence;Task.firstSuccess=firstSuccess;Task.never=never;Task.fromPromise=fromPromise;Task.race=race;Task.external=external;Task.emitter=emitter;Task.trySequence=trySequence;Task.none=none;Task.succeedBy=succeedBy;Task.ap=ap;Task.map2=map2;Task.map3=map3;Task.map4=map4;class ExternalTask extends Task{constructor(){super((reject,resolve)=>{switch(this.lastState){case"error":reject(this.alreadyError);case"success":resolve(this.alreadyResult);case"pending":this.computationReject=reject;this.computationResolve=resolve}});this.lastState="pending"}reject(error){this.alreadyError=error;this.lastState="error";if(this.computationReject){this.computationReject(error)}}resolve(result){this.alreadyResult=result;this.lastState="success";if(this.computationResolve){this.computationResolve(result)}}}function external(){return new ExternalTask}function emitter(fn){const task=external();return[task,(...args)=>{try{task.resolve(fn(...args))}catch(e){task.reject(e)}}]}function succeed(result){return new Task((_,resolve)=>resolve(result))}const of=succeed;function succeedBy(result){return new Task((reject,resolve)=>{try{resolve(result())}catch(e){reject(e)}})}function empty(){return of(void 0)}function succeedIn(ms,result){return new Task((_,resolve)=>setTimeout(()=>resolve(result),ms))}function fail(error){return new Task((reject,_)=>reject(error))}function failIn(ms,error){return new Task((reject,_)=>setTimeout(()=>reject(error),ms))}function never(){return new Task(()=>void 0)}function andThen(fn,task){return new Task((reject,resolve)=>task.fork(reject,b=>fn(b).fork(reject,resolve)))}function succeedIf(fn,task){return new Task((reject,resolve)=>{const result=fn();if(result){resolve(result);return}task.fork(reject,resolve)})}function onlyOnce(task){let state="initialized";let cachedResult;let cachedError;let callbackId=0;const callbacks={};function notify(reject,resolve){const id=callbackId++;callbacks[id]={reject:reject,resolve:resolve}}function triggerReject(error){state="failure";cachedError=error;Object.keys(callbacks).forEach(id=>{callbacks[id].reject(error);delete callbacks[id]})}function triggerResolve(result){state="success";cachedResult=result;Object.keys(callbacks).forEach(id=>{callbacks[id].resolve(result);delete callbacks[id]})}return new Task((reject,resolve)=>{switch(state){case"success":resolve(cachedResult);break;case"failure":reject(cachedError);break;case"pending":notify(reject,resolve);break;case"initialized":state="pending";notify(reject,resolve);task.fork(triggerReject,triggerResolve)}})}function fromPromise(maybePromise){if(maybePromise instanceof Promise){return new Task((reject,resolve)=>maybePromise.then(resolve,reject))}return of(maybePromise)}function toPromise(task){return new Promise((resolve,reject)=>task.fork(reject,resolve))}function race(tasks){return new Task((reject,resolve)=>{let done=false;return tasks.map(task=>task.fork(error=>{if(done){return}done=true;reject(error)},result=>{if(done){return}done=true;resolve(result)}))})}class EndOfSequence extends Error{constructor(){super("End of sequence")}}function trySequence(onError,tasks){const[head,...tail]=tasks;if(!head){return fail(new EndOfSequence)}return head.orElse(e=>{const shouldContinue=onError(e);if(shouldContinue===false){return fail(e)}if(shouldContinue===true){return trySequence(onError,tail)}return shouldContinue})}function firstSuccess(tasks){if(tasks.length===0){return fail([])}return new Task((reject,resolve)=>{let isDone=false;let runningTasks=tasks.length;const errors=[];return tasks.map(task=>task.fork(error=>{if(isDone){return}runningTasks-=1;errors.push(error);if(runningTasks===0){reject(errors)}},result=>{if(isDone){return}isDone=true;resolve(result)}))})}function all(tasks){if(tasks.length===0){return of([])}return new Task((reject,resolve)=>{let isDone=false;let runningTasks=tasks.length;const results=[];return tasks.map((task,i)=>task.fork(error=>{if(isDone){return}isDone=true;reject(error)},result=>{if(isDone){return}runningTasks-=1;results[i]=result;if(runningTasks===0){resolve(results)}}))})}function sequence(tasks){if(tasks.length===0){return of([])}return tasks.reduce((sum,task)=>{return andThen(list=>{return map(result=>[...list,result],task)},sum)},succeed([]))}function swap(task){return new Task((reject,resolve)=>task.fork(resolve,reject))}function map(fn,task){return new Task((reject,resolve)=>task.fork(reject,result=>resolve(fn(result))))}function map2(fn,taskA,taskB){return Task.of(fn).ap(taskA).ap(taskB)}function map3(fn,taskA,taskB,taskC){return Task.of(fn).ap(taskA).ap(taskB).ap(taskC)}function map4(fn,taskA,taskB,taskC,taskD){return Task.of(fn).ap(taskA).ap(taskB).ap(taskC).ap(taskD)}function tap(fn,task){return map(result=>{fn(result);return result},task)}function mapError(fn,task){return new Task((reject,resolve)=>task.fork(error=>reject(fn(error)),resolve))}function mapBoth(handleError,handleSuccess,task){return mapError(handleError,map(handleSuccess,task))}function fold(handleError,handleSuccess,task){return new Task((_,resolve)=>task.fork(error=>resolve(handleError(error)),result=>resolve(handleSuccess(result))))}function orElse(fn,task){return new Task((reject,resolve)=>task.fork(error=>fn(error).fork(reject,resolve),resolve))}function ap(task,appliedTask){return new Task((reject,resolve)=>{let targetResult;let applierFunction;let hasResultLoaded=false;let isRejected=false;const handleResolve=onResolve=>{return x=>{if(isRejected){return}onResolve(x);if(applierFunction&&hasResultLoaded){resolve(applierFunction(targetResult))}}};const handleReject=x=>{if(isRejected){return}isRejected=true;reject(x)};task.fork(handleReject,handleResolve(x=>{applierFunction=x}));appliedTask.fork(handleReject,handleResolve(x=>{hasResultLoaded=true;targetResult=x}))})}function wait(ms,task){return new Task((reject,resolve)=>{setTimeout(()=>task.fork(reject,resolve),ms)})}function retryIn(ms,task){return task.orElse(()=>task.wait(ms))}function retryWithExponentialBackoff(ms,times,task){return range(times).reduce((sum,i)=>sum.retryIn(ms*2**i),task)}function get(url,config){return fromPromise(axios.get(url,config))}function delete_(url,config){return fromPromise(axios.delete(url,config))}function head(url,config){return fromPromise(axios.head(url,config))}function post(url,data,config){return fromPromise(axios.post(url,data,config))}function put(url,data,config){return fromPromise(axios.put(url,data,config))}function patch(url,data,config){return fromPromise(axios.patch(url,data,config))}function toJSON(resp){const type=resp.config?resp.config.responseType:"text";switch(type){case"json":return succeed(resp.data);case"text":try{return succeed(JSON.parse(resp.data))}catch(e){return fail(e)}default:return fail(new Error("Invalid data"))}}var HTTP=Object.freeze({__proto__:null,get:get,delete_:delete_,head:head,post:post,put:put,patch:patch,toJSON:toJSON});function initialize(){return{type:"Initialized"}}function pending(){return{type:"Pending"}}function succeed$1(result){return{type:"Success",result:result}}function fail$1(error){return{type:"Failure",error:error}}function fold$1(onInitialized,onPending,onFailure,onSuccess,remote){switch(remote.type){case"Initialized":return onInitialized();case"Pending":return onPending();case"Failure":return onFailure(remote.error);case"Success":return onSuccess(remote.result)}}function fromTask(task){return task.map(succeed$1).orElse(e=>of(fail$1(e)))}var RemoteData=Object.freeze({__proto__:null,initialize:initialize,pending:pending,succeed:succeed$1,fail:fail$1,fold:fold$1,fromTask:fromTask});class Subscription{constructor(){this.eventSubscribers=new Set;this.status="inactive";this.statusSubscribers=new Set}emit(value){return Task.all(Array.from(this.eventSubscribers).map(sub=>sub(value)||Task.empty()))}subscribe(fn){this.eventSubscribers.add(fn);return()=>{this.eventSubscribers.delete(fn);this.checkStatus()}}clear(){this.eventSubscribers.clear();this.checkStatus()}onStatusChange(fn){this.statusSubscribers.add(fn);return()=>this.statusSubscribers.delete(fn)}checkStatus(){const newstatus=this.eventSubscribers.size>0?"active":"inactive";if(newstatus===this.status){return}this.status=newstatus;Array.from(this.statusSubscribers).map(sub=>sub(newstatus))}}export{EndOfSequence,ExternalTask,HTTP,RemoteData,Subscription,Task,range,to}; |
{ | ||
"name": "@tdreyno/pretty-please", | ||
"version": "1.0.0-beta.19", | ||
"version": "1.0.0-beta.20", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "dist-*/", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
315005
3665