codecamp

TestScheduler

class TestScheduler extends VirtualTimeScheduler {
      static parseMarblesAsSubscriptions(marbles: string, runMode: boolean = false): SubscriptionLog
      static parseMarbles(marbles: string, values?: any, errorValue?: any, materializeInnerObservables: boolean = false, runMode: boolean = false): TestMessage[]
      constructor(assertDeepEqual: (actual: any, expected: any) => boolean | void)
      get hotObservables: HotObservable<any>[]
      get coldObservables: ColdObservable<any>[]
      assertDeepEqual: (actual: any, expected: any) => boolean | void
      createTime(marbles: string): number
      createColdObservable<T = string>(marbles: string, values?: { [marble: string]: T; }, error?: any): ColdObservable<T>
      createHotObservable<T = string>(marbles: string, values?: { [marble: string]: T; }, error?: any): HotObservable<T>
      expectObservable(observable: Observable<any>, subscriptionMarbles: string = null): ({...})
      expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({...})
      flush()
      run<T>(callback: (helpers: RunHelpers) => T): T

     
      // inherited from index/VirtualTimeScheduler
      protected static frameTimeFactor: number
      constructor(SchedulerAction: typeof AsyncAction = VirtualAction as any, maxFrames: number = Number.POSITIVE_INFINITY)
      frame: number
      index: number
      maxFrames: number
      flush(): void
    }

静态方法

parseMarblesAsSubscriptions() static parseMarblesAsSubscriptions(marbles: string, runMode: boolean = false): SubscriptionLog

参量 类型
marbles 类型: string
运行模式 可选的。 默认值为 false。类型: boolean

Returns SubscriptionLog

parseMarbles() static parseMarbles(marbles: string, values?: any, errorValue?: any, materializeInnerObservables: boolean = false, runMode: boolean = false): TestMessage[]

参量 类型
marbles 类型: string
values 可选的。 默认值为 undefined。类型: any
errorValue 可选的。 默认值为 undefined。类型: any
materializeInnerObservables 可选的。 默认值为 false。         类型: boolean
runMode 可选的。 默认值为 false。类型: boolean

Returns TestMessage[]

建设者

constructor(assertDeepEqual: (actual: any, expected: any) => boolean | void)

参量 类型
assertDeepEqual 类型: (actual: any, expected: any) => boolean | void

物产

属性 类型 描述
hotObservables HotObservable<any>[] 只读。
coldObservables ColdObservable<any>[] 只读。
assertDeepEqual (actual: any, expected: any) => boolean | void 在构造函数中声明。

方法

createTime() createTime(marbles: string): number

参量 类型
marbles 类型: string

Returns number

createColdObservable() createColdObservable<T = string>(marbles: string, values?: { [marble: string]: T; }, error?: any): ColdObservable<T>

参量 类型
marbles A diagram in the marble DSL. Letters map to keys in values if provided.
values 可选的。 默认值为 undefined。用于中的字母的值 marbles。 如果省略,则使用字母本身。
error 可选的。 默认值为 undefined。The error to use for the # marble (if present).Returns  ColdObservable<T>

createHotObservable() createHotObservable<T = string>(marbles: string, values?: { [marble: string]: T; }, error?: any): HotObservable<T>

参量 类型
marbles A diagram in the marble DSL. Letters map to keys in values if provided.
values 可选的。 默认值为 undefined。用于中的字母的值 marbles。 如果省略,则使用字母本身。
error 可选的。 默认值为 undefined。The error to use for the # marble (if present).

Returns HotObservable<T>

ExpectObservable() expectObservable(observable: Observable<any>, subscriptionMarbles: string = null): ({toBe: observableToBeFn; })

参量 类型
observable 类型: Observable
subscriptionMarbles 可选的。 默认值为 null。类型: string

Returns ({ toBe: observableToBeFn; })

ExpectSubscriptions() expectSubscriptions(actualSubscriptionLogs: SubscriptionLog[]): ({toBe: subscriptionLogsToBeFn; })

参量 类型
actualSubscriptionLogs 类型: SubscriptionLog[]

Returns ({ toBe: subscriptionLogsToBeFn; })

flush()
flush()  参量  没有参数。

run()

run<T>(callback: (helpers: RunHelpers) => T): T

参量 类型
callback 类型: (helpers: RunHelpers) => T

Returns T

WebSocketSubjectConfig
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

RxJS operators

RxJS fetch

RxJS testing

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }