main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
764 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var getBuiltIn = require('../internals/get-built-in');
|
---|
4 | var isConstructor = require('../internals/is-constructor');
|
---|
5 |
|
---|
6 | var Array = getBuiltIn('Array');
|
---|
7 |
|
---|
8 | // `Observable.of` method
|
---|
9 | // https://github.com/tc39/proposal-observable
|
---|
10 | $({ target: 'Observable', stat: true, forced: true }, {
|
---|
11 | of: function of() {
|
---|
12 | var C = isConstructor(this) ? this : getBuiltIn('Observable');
|
---|
13 | var length = arguments.length;
|
---|
14 | var items = Array(length);
|
---|
15 | var index = 0;
|
---|
16 | while (index < length) items[index] = arguments[index++];
|
---|
17 | return new C(function (observer) {
|
---|
18 | for (var i = 0; i < length; i++) {
|
---|
19 | observer.next(items[i]);
|
---|
20 | if (observer.closed) return;
|
---|
21 | } observer.complete();
|
---|
22 | });
|
---|
23 | }
|
---|
24 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.