UNPKG

1.96 kBJavaScriptView Raw
1"use strict";
2/**
3 * Copyright 2018 Google Inc. All Rights Reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.BrowseCarousel = exports.BrowseCarouselItem = void 0;
19class BrowseCarouselItem {
20 /**
21 * @param options BrowseCarouselItem options
22 * @public
23 */
24 constructor(options) {
25 this.title = options.title;
26 if (options.url) {
27 this.openUrlAction = {
28 url: options.url,
29 };
30 }
31 if (options.openUrlAction) {
32 this.openUrlAction = options.openUrlAction;
33 }
34 this.description = options.description;
35 this.footer = options.footer;
36 this.image = options.image;
37 }
38}
39exports.BrowseCarouselItem = BrowseCarouselItem;
40const isOptions = (options) => {
41 const test = options;
42 return Array.isArray(test.items);
43};
44class BrowseCarousel {
45 constructor(options, ...items) {
46 if (!options) {
47 this.items = [];
48 return;
49 }
50 if (Array.isArray(options)) {
51 this.items = options;
52 return;
53 }
54 if (isOptions(options)) {
55 this.imageDisplayOptions = options.display;
56 this.items = options.items;
57 return;
58 }
59 this.items = [options].concat(items);
60 }
61}
62exports.BrowseCarousel = BrowseCarousel;
63//# sourceMappingURL=browse.js.map
\No newline at end of file