You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
568 B
Lua

local Observable = require "rx.observable"
local util = require "rx.util"
--- Returns a new Observable that produces the specified values followed by all elements produced by
-- the source Observable.
-- @arg {*...} values - The values to produce before the Observable begins producing values
-- normally.
-- @returns {Observable}
function Observable:startWith(...)
local values = util.pack(...)
return Observable.create(function(observer)
observer:onNext(util.unpack(values))
return self:subscribe(observer)
end)
end