-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbase.js
63 lines (57 loc) · 1.21 KB
/
base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
'use strict';
var BigPipe = require('bigpipe')
, contour = require('./contour')
, npm = contour.get('npm');
/**
* Define small collection of default pagelets, this prevents code duplication.
*
* @constructor
* @api public
*/
function Pagelets() {
this.navigation = require('./pagelets/navigation');
this.footer = contour.footer;
this.analytics = contour.analytics.extend({
data: {
domain: 'browsenpm.org',
key: 'gikqh9ctxn',
type: 'segment'
}
});
}
/**
* Add pagelets to the collection.
*
* @param {Object} pagelets Collection of pagelets listed by name.
* @returns {Pagelets} fluent interface
* @api public
*/
Pagelets.prototype.add = function add(pagelets) {
for (var name in pagelets) {
this[name] = pagelets[name];
}
return this;
};
//
// Create a default page setup for browsenpm.org pages.
//
exports.Page = BigPipe.Page.extend({
dependencies: [
npm.normalize,
npm.global,
npm.grid,
npm.icons,
npm.typography,
npm.animations,
npm.tables
],
});
//
// Simple getter for exposing a fresh set of default pagelets.
//
Object.defineProperty(exports, 'pagelets', {
enumerable: false,
get: function pagelets() {
return new Pagelets;
}
});