Comparing version 0.1.4 to 0.1.5
{ | ||
"name": "lightcast", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"author": "skulptur", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -30,1 +30,42 @@ ## Motivation | ||
``` | ||
Working with groups | ||
```typescript | ||
// say you have a piece of code that accepts callbacks for events | ||
const loader = createLoader({ | ||
onProgress: (progress) => console.log(progress), | ||
onComplete: () => console.log('done'), | ||
}) | ||
``` | ||
```typescript | ||
import { createPubSub } from 'lightcast' | ||
const pubSub = { | ||
onProgress: createPubSub<number>(), | ||
onComplete: createPubSub<void>(), | ||
} | ||
// you could make it work like this... | ||
const loader = createLoader({ | ||
onProgress: pubSub.onProgress.dispatch, | ||
onComplete: pubSub.onComplete.dispatch, | ||
// ... | ||
}) | ||
``` | ||
```typescript | ||
import { createPubSub, groupByAction } from 'lightcast' | ||
// but it is easier to group by dispatch/subscribe/dispose | ||
const pubSub = groupByAction({ | ||
onProgress: createPubSub<number>(), | ||
onComplete: createPubSub<void>(), | ||
}) | ||
const loader = createLoader({ | ||
...pubSub.dispatch, | ||
// ... | ||
}) | ||
``` |
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
19879
71