本文整理汇总了TypeScript中@cycle/run/lib/adapt.adapt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript adapt函数的具体用法?TypeScript adapt怎么用?TypeScript adapt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adapt函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private _mockConfig: MockConfig) {
if (_mockConfig.elements) {
this._elements = _mockConfig.elements as FantasyObservable;
} else {
this._elements = adapt(xs.empty());
}
}
开发者ID:ntilwalli,项目名称:cyclejs,代码行数:7,代码来源:mockDOMSource.ts
示例2: elements
public elements(): MemoryStream<HTMLBodyElement> {
const out: DevToolEnabledSource & MemoryStream<HTMLBodyElement> = adapt(
xs.of(document.body),
);
out._isCycleSource = this._name;
return out;
}
开发者ID:joeldentici,项目名称:cyclejs,代码行数:7,代码来源:BodyDOMSource.ts
示例3: start
return function delayOperator<T>(inputStream: Stream<T>): Stream<T> {
const stream = xs.fromObservable(inputStream);
let delayListener: any = null;
const producer = {
start(listener: Listener<T>) {
delayListener = makeDelayListener<T>(
schedule,
currentTime,
delayTime,
listener
);
stream.addListener(delayListener);
},
stop() {
if (delayListener) {
stream.removeListener(delayListener);
}
},
};
return adapt(xs.create<T>(producer));
};
开发者ID:,项目名称:,代码行数:25,代码来源:
示例4: events
public events(eventType: string, options?: EventsFnOptions): any {
const streamForEventType = this._mockConfig[eventType] as any;
const out: DevToolEnabledSource & FantasyObservable = adapt(streamForEventType || xs.empty());
out._isCycleSource = 'MockedDOM';
return out;
}
开发者ID:whitecolor,项目名称:cyclejs,代码行数:8,代码来源:mockDOMSource.ts
示例5: element
public element(): any {
const output$: MemoryStream<Element> = this.elements()
.filter((arr: Array<any>) => arr.length > 0)
.map((arr: Array<any>) => arr[0])
.remember();
const out: DevToolEnabledSource & MemoryStream<Element> = adapt(output$);
out._isCycleSource = 'MockedDOM';
return out;
}
开发者ID:cyclejs,项目名称:cyclejs,代码行数:9,代码来源:mockDOMSource.ts
示例6: adapt
animationFrames: () => {
const s = timeSource.periodic(16);
if ('pipe' in s) {
// This hack brought to you by the need to import rxjs's operators
// and my desire to not force a dependency on rxjs
return adapt(xs.fromObservable<number>(s).map(frame));
}
return s.map(frame);
},
开发者ID:,项目名称:,代码行数:11,代码来源:
示例7: events
public events(eventType: string, options: EventsFnOptions = {}): Stream<Event> {
let stream: Stream<Event>;
if (options && typeof options.useCapture === 'boolean') {
stream = fromEvent(document, eventType, options.useCapture);
} else {
stream = fromEvent(document, eventType);
}
const out: DevToolEnabledSource & Stream<Event> = adapt(stream);
out._isCycleSource = this._name;
return out;
}
开发者ID:whitecolor,项目名称:cyclejs,代码行数:11,代码来源:DocumentDOMSource.ts
示例8: isolateSink
public isolateSink(sink: any, scope: string): any {
return adapt(
xs.fromObservable<any>(sink).map((vnode: VNode) => {
if (vnode.sel && vnode.sel.indexOf(SCOPE_PREFIX + scope) !== -1) {
return vnode;
} else {
vnode.sel += `.${SCOPE_PREFIX}${scope}`;
return vnode;
}
})
);
}
开发者ID:cyclejs,项目名称:cyclejs,代码行数:12,代码来源:mockDOMSource.ts
示例9: softNormalizeRequestInput
function requestInputToResponse$(reqInput: RequestInput): ResponseMemoryStream {
let response$ = createResponse$(reqInput).remember();
const reqOptions = softNormalizeRequestInput(reqInput);
if (!reqOptions.lazy) {
response$.addListener({next: () => {}, error: () => {}, complete: () => {}});
}
response$ = adapt(response$);
Object.defineProperty(response$, 'request', {
value: reqOptions,
writable: false,
});
return response$ as ResponseMemoryStream;
};
开发者ID:whitecolor,项目名称:cyclejs,代码行数:13,代码来源:http-driver.ts
注:本文中的@cycle/run/lib/adapt.adapt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论