new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iif.js","sources":["../../../src/internal/observable/iif.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA2FhC,MAAM,UAAU,GAAG,CACjB,SAAwB,EACxB,aAAuC,KAAK,EAC5C,cAAwC,KAAK;IAE7C,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAC7D,CAAC"}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
/**
|
||||
* Emits the most recently emitted value from the source Observable whenever
|
||||
* another Observable, the `notifier`, emits.
|
||||
*
|
||||
* <span class="informal">It's like {@link sampleTime}, but samples whenever
|
||||
* the `notifier` Observable emits something.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Whenever the `notifier` Observable emits a value or completes, `sample`
|
||||
* looks at the source Observable and emits whichever value it has most recently
|
||||
* emitted since the previous sampling, unless the source has not emitted
|
||||
* anything since the previous sampling. The `notifier` is subscribed to as soon
|
||||
* as the output Observable is subscribed.
|
||||
*
|
||||
* ## Example
|
||||
* On every click, sample the most recent "seconds" timer
|
||||
* ```ts
|
||||
* import { fromEvent, interval } from 'rxjs';
|
||||
* import { sample } from 'rxjs/operators';
|
||||
*
|
||||
* const seconds = interval(1000);
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const result = seconds.pipe(sample(clicks));
|
||||
* result.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link audit}
|
||||
* @see {@link debounce}
|
||||
* @see {@link sampleTime}
|
||||
* @see {@link throttle}
|
||||
*
|
||||
* @param {Observable<any>} notifier The Observable to use for sampling the
|
||||
* source Observable.
|
||||
* @return {Observable<T>} An Observable that emits the results of sampling the
|
||||
* values emitted by the source Observable whenever the notifier Observable
|
||||
* emits value or completes.
|
||||
* @method sample
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T>;
|
||||
@@ -0,0 +1,6 @@
|
||||
/** PURE_IMPORTS_START _symbol_iterator PURE_IMPORTS_END */
|
||||
import { iterator as Symbol_iterator } from '../symbol/iterator';
|
||||
export function isIterable(input) {
|
||||
return input && typeof input[Symbol_iterator] === 'function';
|
||||
}
|
||||
//# sourceMappingURL=isIterable.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"takeLast.js","sources":["../src/operators/takeLast.ts"],"names":[],"mappings":";;;;;AAAA,oDAA+C"}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Subject } from './Subject';
|
||||
import { Observer } from './types';
|
||||
import { Subscription } from './Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class SubjectSubscription<T> extends Subscription {
|
||||
subject: Subject<T>;
|
||||
subscriber: Observer<T>;
|
||||
closed: boolean;
|
||||
constructor(subject: Subject<T>, subscriber: Observer<T>);
|
||||
unsubscribe(): void;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/** PURE_IMPORTS_START _symbol_observable PURE_IMPORTS_END */
|
||||
import { observable as Symbol_observable } from '../symbol/observable';
|
||||
export function isInteropObservable(input) {
|
||||
return input && typeof input[Symbol_observable] === 'function';
|
||||
}
|
||||
//# sourceMappingURL=isInteropObservable.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J E F G BC"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC tB I u DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"I u J E F"},E:{"1":"J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d rB","2":"G B C OC PC QC RC qB 9B SC"},G:{"1":"F UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"zB TC AC"},H:{"1":"nC"},I:{"1":"tB I D rC AC sC tC","2":"oC pC qC"},J:{"1":"A","2":"E"},K:{"1":"e rB","2":"A B C qB 9B"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:5,C:"matchMedia"};
|
||||
@@ -0,0 +1,45 @@
|
||||
import Block from './Block';
|
||||
import { CompileOptions, Var } from '../../interfaces';
|
||||
import Component from '../Component';
|
||||
import FragmentWrapper from './wrappers/Fragment';
|
||||
import { Node, Identifier, MemberExpression, Literal, Expression } from 'estree';
|
||||
interface ContextMember {
|
||||
name: string;
|
||||
index: Literal;
|
||||
is_contextual: boolean;
|
||||
is_non_contextual: boolean;
|
||||
variable: Var;
|
||||
priority: number;
|
||||
}
|
||||
export default class Renderer {
|
||||
component: Component;
|
||||
options: CompileOptions;
|
||||
context: ContextMember[];
|
||||
initial_context: ContextMember[];
|
||||
context_lookup: Map<string, ContextMember>;
|
||||
context_overflow: boolean;
|
||||
blocks: Array<Block | Node | Node[]>;
|
||||
readonly: Set<string>;
|
||||
meta_bindings: Array<Node | Node[]>;
|
||||
binding_groups: Map<string, {
|
||||
binding_group: (to_reference?: boolean) => Node;
|
||||
is_context: boolean;
|
||||
contexts: string[];
|
||||
index: number;
|
||||
keypath: string;
|
||||
}>;
|
||||
block: Block;
|
||||
fragment: FragmentWrapper;
|
||||
file_var: Identifier;
|
||||
locate: (c: number) => {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
constructor(component: Component, options: CompileOptions);
|
||||
add_to_context(name: string, contextual?: boolean): ContextMember;
|
||||
invalidate(name: string, value?: any, main_execution_context?: boolean): any;
|
||||
dirty(names: string[], is_reactive_declaration?: boolean): Expression;
|
||||
reference(node: string | Identifier | MemberExpression): any;
|
||||
remove_block(block: Block | Node | Node[]): void;
|
||||
}
|
||||
export {};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"J E F G A B","16":"BC"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB EC","2":"CC tB","16":"DC"},D:{"1":"4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 I u J E F G A B C K L H M N O v w x y z"},E:{"1":"J E F G A B C K L H IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u GC zB HC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d SC rB","2":"G B OC PC QC RC qB 9B"},G:{"1":"fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC"},H:{"2":"nC"},I:{"1":"D sC tC","2":"tB I oC pC qC rC AC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:1,C:"indeterminate checkbox"};
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/repeatWhen';
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operator/windowWhen"));
|
||||
//# sourceMappingURL=windowWhen.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"is-interactive","version":"1.0.0","files":{"license":{"checkedAt":1678887829653,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"index.d.ts":{"checkedAt":1678887830131,"integrity":"sha512-Mkmx0oD8g5P/7kXqlh1+JdrrGTVuub3alJ8K/naBdX2BkdxLhFaGyjpbZlan5kDoqdtmhGcN/Jg+E6R3B0Oz1w==","mode":420,"size":717},"package.json":{"checkedAt":1678887830131,"integrity":"sha512-eBNvj812Ld0lvrYbwItyCC1U41ReCw+HtBFOasNRF06WP2tIEQycp3Z0Gntkcq1CMUHoau6aJ5qVJiw1MIy4HA==","mode":420,"size":635},"index.js":{"checkedAt":1678887830131,"integrity":"sha512-uTLHOl7362PWkv/yJNNkUmO84wxjRWoe/N9da/mamQw1whNwH8I2dhZRyw44bcIRoqy2EGCuUXy58kSksRp/pA==","mode":420,"size":180},"readme.md":{"checkedAt":1678887830133,"integrity":"sha512-zCnwHGcMH+nRr++k+rRdUpxQVJaGrq8KgDjZPPfpYmug1zAPTehV9CRAoS/KaBc4kMcEsjbxIKBERpiZudJpng==","mode":420,"size":1978}}}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bufferWhen.js","sources":["../../../src/internal/operators/bufferWhen.ts"],"names":[],"mappings":"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"}
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("rxjs-compat/add/operator/skipWhile");
|
||||
//# sourceMappingURL=skipWhile.js.map
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2018 Thomas Watson Steen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,379 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { identity } from '../util/identity';
|
||||
import { SchedulerAction, SchedulerLike } from '../types';
|
||||
import { isScheduler } from '../util/isScheduler';
|
||||
|
||||
export type ConditionFunc<S> = (state: S) => boolean;
|
||||
export type IterateFunc<S> = (state: S) => S;
|
||||
export type ResultFunc<S, T> = (state: S) => T;
|
||||
|
||||
interface SchedulerState<T, S> {
|
||||
needIterate?: boolean;
|
||||
state: S;
|
||||
subscriber: Subscriber<T>;
|
||||
condition?: ConditionFunc<S>;
|
||||
iterate: IterateFunc<S>;
|
||||
resultSelector: ResultFunc<S, T>;
|
||||
}
|
||||
|
||||
export interface GenerateBaseOptions<S> {
|
||||
/**
|
||||
* Initial state.
|
||||
*/
|
||||
initialState: S;
|
||||
/**
|
||||
* Condition function that accepts state and returns boolean.
|
||||
* When it returns false, the generator stops.
|
||||
* If not specified, a generator never stops.
|
||||
*/
|
||||
condition?: ConditionFunc<S>;
|
||||
/**
|
||||
* Iterate function that accepts state and returns new state.
|
||||
*/
|
||||
iterate: IterateFunc<S>;
|
||||
/**
|
||||
* SchedulerLike to use for generation process.
|
||||
* By default, a generator starts immediately.
|
||||
*/
|
||||
scheduler?: SchedulerLike;
|
||||
}
|
||||
|
||||
export interface GenerateOptions<T, S> extends GenerateBaseOptions<S> {
|
||||
/**
|
||||
* Result selection function that accepts state and returns a value to emit.
|
||||
*/
|
||||
resultSelector: ResultFunc<S, T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* const res = generate(0, x => x < 10, x => x + 1, x => x);
|
||||
*
|
||||
* @example <caption>Using asap scheduler, produces sequence of 2, 3, 5, then completes.</caption>
|
||||
* const res = generate(1, x => x < 5, x => x * 2, x => x + 1, asap);
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link Observable}
|
||||
*
|
||||
* @param {S} initialState Initial state.
|
||||
* @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).
|
||||
* @param {function (state: S): S} iterate Iteration step function.
|
||||
* @param {function (state: S): T} resultSelector Selector function for results produced in the sequence. (deprecated)
|
||||
* @param {SchedulerLike} [scheduler] A {@link SchedulerLike} on which to run the generator loop. If not provided, defaults to emit immediately.
|
||||
* @returns {Observable<T>} The generated sequence.
|
||||
*/
|
||||
export function generate<T, S>(initialState: S,
|
||||
condition: ConditionFunc<S>,
|
||||
iterate: IterateFunc<S>,
|
||||
resultSelector: ResultFunc<S, T>,
|
||||
scheduler?: SchedulerLike): Observable<T>;
|
||||
|
||||
/**
|
||||
* Generates an Observable by running a state-driven loop
|
||||
* that emits an element on each iteration.
|
||||
*
|
||||
* <span class="informal">Use it instead of nexting values in a for loop.</span>
|
||||
*
|
||||
* <img src="./img/generate.png" width="100%">
|
||||
*
|
||||
* `generate` allows you to create stream of values generated with a loop very similar to
|
||||
* traditional for loop. First argument of `generate` is a beginning value. Second argument
|
||||
* is a function that accepts this value and tests if some condition still holds. If it does,
|
||||
* loop continues, if not, it stops. Third value is a function which takes previously defined
|
||||
* value and modifies it in some way on each iteration. Note how these three parameters
|
||||
* are direct equivalents of three expressions in regular for loop: first expression
|
||||
* initializes some state (for example numeric index), second tests if loop can make next
|
||||
* iteration (for example if index is lower than 10) and third states how defined value
|
||||
* will be modified on every step (index will be incremented by one).
|
||||
*
|
||||
* Return value of a `generate` operator is an Observable that on each loop iteration
|
||||
* emits a value. First, condition function is ran. If it returned true, Observable
|
||||
* emits currently stored value (initial value at the first iteration) and then updates
|
||||
* that value with iterate function. If at some point condition returned false, Observable
|
||||
* completes at that moment.
|
||||
*
|
||||
* Optionally you can pass fourth parameter to `generate` - a result selector function which allows you
|
||||
* to immediately map value that would normally be emitted by an Observable.
|
||||
*
|
||||
* If you find three anonymous functions in `generate` call hard to read, you can provide
|
||||
* single object to the operator instead. That object has properties: `initialState`,
|
||||
* `condition`, `iterate` and `resultSelector`, which should have respective values that you
|
||||
* would normally pass to `generate`. `resultSelector` is still optional, but that form
|
||||
* of calling `generate` allows you to omit `condition` as well. If you omit it, that means
|
||||
* condition always holds, so output Observable will never complete.
|
||||
*
|
||||
* Both forms of `generate` can optionally accept a scheduler. In case of multi-parameter call,
|
||||
* scheduler simply comes as a last argument (no matter if there is resultSelector
|
||||
* function or not). In case of single-parameter call, you can provide it as a
|
||||
* `scheduler` property on object passed to the operator. In both cases scheduler decides when
|
||||
* next iteration of the loop will happen and therefore when next value will be emitted
|
||||
* by the Observable. For example to ensure that each value is pushed to the observer
|
||||
* on separate task in event loop, you could use `async` scheduler. Note that
|
||||
* by default (when no scheduler is passed) values are simply emitted synchronously.
|
||||
*
|
||||
*
|
||||
* @example <caption>Use with condition and iterate functions.</caption>
|
||||
* const generated = generate(0, x => x < 3, x => x + 1);
|
||||
*
|
||||
* generated.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('Yo!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1
|
||||
* // 2
|
||||
* // "Yo!"
|
||||
*
|
||||
*
|
||||
* @example <caption>Use with condition, iterate and resultSelector functions.</caption>
|
||||
* const generated = generate(0, x => x < 3, x => x + 1, x => x * 1000);
|
||||
*
|
||||
* generated.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('Yo!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1000
|
||||
* // 2000
|
||||
* // "Yo!"
|
||||
*
|
||||
*
|
||||
* @example <caption>Use with options object.</caption>
|
||||
* const generated = generate({
|
||||
* initialState: 0,
|
||||
* condition(value) { return value < 3; },
|
||||
* iterate(value) { return value + 1; },
|
||||
* resultSelector(value) { return value * 1000; }
|
||||
* });
|
||||
*
|
||||
* generated.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('Yo!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1000
|
||||
* // 2000
|
||||
* // "Yo!"
|
||||
*
|
||||
* @example <caption>Use options object without condition function.</caption>
|
||||
* const generated = generate({
|
||||
* initialState: 0,
|
||||
* iterate(value) { return value + 1; },
|
||||
* resultSelector(value) { return value * 1000; }
|
||||
* });
|
||||
*
|
||||
* generated.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('Yo!') // This will never run.
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1000
|
||||
* // 2000
|
||||
* // 3000
|
||||
* // ...and never stops.
|
||||
*
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link index/Observable.create}
|
||||
*
|
||||
* @param {S} initialState Initial state.
|
||||
* @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).
|
||||
* @param {function (state: S): S} iterate Iteration step function.
|
||||
* @param {function (state: S): T} [resultSelector] Selector function for results produced in the sequence.
|
||||
* @param {Scheduler} [scheduler] A {@link Scheduler} on which to run the generator loop. If not provided, defaults to emitting immediately.
|
||||
* @return {Observable<T>} The generated sequence.
|
||||
*/
|
||||
export function generate<S>(initialState: S,
|
||||
condition: ConditionFunc<S>,
|
||||
iterate: IterateFunc<S>,
|
||||
scheduler?: SchedulerLike): Observable<S>;
|
||||
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload accepts options object that might contain initial state, iterate,
|
||||
* condition and scheduler.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* const res = generate({
|
||||
* initialState: 0,
|
||||
* condition: x => x < 10,
|
||||
* iterate: x => x + 1,
|
||||
* });
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link Observable}
|
||||
*
|
||||
* @param {GenerateBaseOptions<S>} options Object that must contain initialState, iterate and might contain condition and scheduler.
|
||||
* @returns {Observable<S>} The generated sequence.
|
||||
*/
|
||||
export function generate<S>(options: GenerateBaseOptions<S>): Observable<S>;
|
||||
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload accepts options object that might contain initial state, iterate,
|
||||
* condition, result selector and scheduler.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* const res = generate({
|
||||
* initialState: 0,
|
||||
* condition: x => x < 10,
|
||||
* iterate: x => x + 1,
|
||||
* resultSelector: x => x,
|
||||
* });
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link Observable}
|
||||
*
|
||||
* @param {GenerateOptions<T, S>} options Object that must contain initialState, iterate, resultSelector and might contain condition and scheduler.
|
||||
* @returns {Observable<T>} The generated sequence.
|
||||
*/
|
||||
export function generate<T, S>(options: GenerateOptions<T, S>): Observable<T>;
|
||||
|
||||
export function generate<T, S>(initialStateOrOptions: S | GenerateOptions<T, S>,
|
||||
condition?: ConditionFunc<S>,
|
||||
iterate?: IterateFunc<S>,
|
||||
resultSelectorOrObservable?: (ResultFunc<S, T>) | SchedulerLike,
|
||||
scheduler?: SchedulerLike): Observable<T> {
|
||||
|
||||
let resultSelector: ResultFunc<S, T>;
|
||||
let initialState: S;
|
||||
|
||||
if (arguments.length == 1) {
|
||||
const options = initialStateOrOptions as GenerateOptions<T, S>;
|
||||
initialState = options.initialState;
|
||||
condition = options.condition;
|
||||
iterate = options.iterate;
|
||||
resultSelector = options.resultSelector || identity as ResultFunc<S, T>;
|
||||
scheduler = options.scheduler;
|
||||
} else if (resultSelectorOrObservable === undefined || isScheduler(resultSelectorOrObservable)) {
|
||||
initialState = initialStateOrOptions as S;
|
||||
resultSelector = identity as ResultFunc<S, T>;
|
||||
scheduler = resultSelectorOrObservable as SchedulerLike;
|
||||
} else {
|
||||
initialState = initialStateOrOptions as S;
|
||||
resultSelector = resultSelectorOrObservable as ResultFunc<S, T>;
|
||||
}
|
||||
|
||||
return new Observable<T>(subscriber => {
|
||||
let state = initialState;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule<SchedulerState<T, S>>(dispatch, 0, {
|
||||
subscriber,
|
||||
iterate,
|
||||
condition,
|
||||
resultSelector,
|
||||
state
|
||||
});
|
||||
}
|
||||
|
||||
do {
|
||||
if (condition) {
|
||||
let conditionResult: boolean;
|
||||
try {
|
||||
conditionResult = condition(state);
|
||||
} catch (err) {
|
||||
subscriber.error(err);
|
||||
return undefined;
|
||||
}
|
||||
if (!conditionResult) {
|
||||
subscriber.complete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
let value: T;
|
||||
try {
|
||||
value = resultSelector(state);
|
||||
} catch (err) {
|
||||
subscriber.error(err);
|
||||
return undefined;
|
||||
}
|
||||
subscriber.next(value);
|
||||
if (subscriber.closed) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
state = iterate(state);
|
||||
} catch (err) {
|
||||
subscriber.error(err);
|
||||
return undefined;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
function dispatch<T, S>(this: SchedulerAction<SchedulerState<T, S>>, state: SchedulerState<T, S>) {
|
||||
const { subscriber, condition } = state;
|
||||
if (subscriber.closed) {
|
||||
return undefined;
|
||||
}
|
||||
if (state.needIterate) {
|
||||
try {
|
||||
state.state = state.iterate(state.state);
|
||||
} catch (err) {
|
||||
subscriber.error(err);
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
state.needIterate = true;
|
||||
}
|
||||
if (condition) {
|
||||
let conditionResult: boolean;
|
||||
try {
|
||||
conditionResult = condition(state.state);
|
||||
} catch (err) {
|
||||
subscriber.error(err);
|
||||
return undefined;
|
||||
}
|
||||
if (!conditionResult) {
|
||||
subscriber.complete();
|
||||
return undefined;
|
||||
}
|
||||
if (subscriber.closed) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
let value: T;
|
||||
try {
|
||||
value = state.resultSelector(state.state);
|
||||
} catch (err) {
|
||||
subscriber.error(err);
|
||||
return undefined;
|
||||
}
|
||||
if (subscriber.closed) {
|
||||
return undefined;
|
||||
}
|
||||
subscriber.next(value);
|
||||
if (subscriber.closed) {
|
||||
return undefined;
|
||||
}
|
||||
return this.schedule(state);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@octokit/openapi-types",
|
||||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/octokit/openapi-types.ts.git",
|
||||
"directory": "packages/openapi-types"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "12.11.0",
|
||||
"main": "",
|
||||
"types": "types.d.ts",
|
||||
"author": "Gregor Martynus (https://twitter.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"octokit": {
|
||||
"openapi-version": "6.8.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// MathML
|
||||
// http://www.w3.org/Math/
|
||||
// By Addy Osmani
|
||||
// Based on work by Davide (@dpvc) and David (@davidcarlisle)
|
||||
// in https://github.com/mathjax/MathJax/issues/182
|
||||
|
||||
Modernizr.addTest('mathml', function(){
|
||||
var hasMathML = false;
|
||||
if ( document.createElementNS ) {
|
||||
var ns = "http://www.w3.org/1998/Math/MathML",
|
||||
div = document.createElement("div");
|
||||
div.style.position = "absolute";
|
||||
var mfrac = div.appendChild(document.createElementNS(ns,"math"))
|
||||
.appendChild(document.createElementNS(ns,"mfrac"));
|
||||
mfrac.appendChild(document.createElementNS(ns,"mi"))
|
||||
.appendChild(document.createTextNode("xx"));
|
||||
mfrac.appendChild(document.createElementNS(ns,"mi"))
|
||||
.appendChild(document.createTextNode("yy"));
|
||||
document.body.appendChild(div);
|
||||
hasMathML = div.offsetHeight > div.offsetWidth;
|
||||
}
|
||||
return hasMathML;
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operator/bufferToggle';
|
||||
@@ -0,0 +1,3 @@
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
export declare function distinctUntilKeyChanged<T>(key: keyof T): MonoTypeOperatorFunction<T>;
|
||||
export declare function distinctUntilKeyChanged<T, K extends keyof T>(key: K, compare: (x: T[K], y: T[K]) => boolean): MonoTypeOperatorFunction<T>;
|
||||
@@ -0,0 +1,51 @@
|
||||
declare const importCwd: {
|
||||
/**
|
||||
Import a module like with [`require()`](https://nodejs.org/api/globals.html#globals_require) but from the current working directory.
|
||||
|
||||
@param moduleId - What you would use in `require()`.
|
||||
@throws Like `require()`, throws when the module can't be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import importCwd = require('import-cwd');
|
||||
|
||||
// Target module is at '/Users/sindresorhus/unicorn/foo.js'
|
||||
|
||||
console.log(__dirname);
|
||||
//=> '/Users/sindresorhus/rainbow'
|
||||
|
||||
console.log(process.cwd());
|
||||
//=> '/Users/sindresorhus/unicorn'
|
||||
|
||||
const foo = importCwd('./foo');
|
||||
```
|
||||
*/
|
||||
(moduleId: string): unknown;
|
||||
|
||||
|
||||
/**
|
||||
Import a module like with [`require()`](https://nodejs.org/api/globals.html#globals_require) but from the current working directory.
|
||||
|
||||
@param moduleId - What you would use in `require()`.
|
||||
@returns `undefined` instead of throwing when the module can't be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import importCwd = require('import-cwd');
|
||||
|
||||
// '/Users/sindresorhus/empty/' is empty
|
||||
|
||||
console.log(__dirname);
|
||||
//=> '/Users/sindresorhus/rainbow'
|
||||
|
||||
console.log(process.cwd());
|
||||
//=> '/Users/sindresorhus/empty'
|
||||
|
||||
const foo = importCwd.silent('./nonexistent');
|
||||
//=> undefined
|
||||
```
|
||||
*/
|
||||
silent(moduleId: string): unknown;
|
||||
};
|
||||
|
||||
export = importCwd;
|
||||
@@ -0,0 +1,26 @@
|
||||
// data uri test.
|
||||
// https://github.com/Modernizr/Modernizr/issues/14
|
||||
|
||||
// This test is asynchronous. Watch out.
|
||||
|
||||
|
||||
// in IE7 in HTTPS this can cause a Mixed Content security popup.
|
||||
// github.com/Modernizr/Modernizr/issues/362
|
||||
// To avoid that you can create a new iframe and inject this.. perhaps..
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
var datauri = new Image();
|
||||
|
||||
|
||||
datauri.onerror = function() {
|
||||
Modernizr.addTest('datauri', function () { return false; });
|
||||
};
|
||||
datauri.onload = function() {
|
||||
Modernizr.addTest('datauri', function () { return (datauri.width == 1 && datauri.height == 1); });
|
||||
};
|
||||
|
||||
datauri.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user