MCPcopy
hub / github.com/gitcoinco/web / constructor

Method constructor

js-sdk/src/index.js:6–19  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

4
5class Widget {
6 constructor(options = {}) {
7 this.options = options;
8 this.el = this.options.el || document.querySelector(options.selector || '.gitcoin-widget');
9 this.options.organization = this.el.dataset.organization || this.options.organization;
10 this.options.repository = this.el.dataset.repository || this.options.repository;
11 this.options.orderBy = this.el.dataset['order-by'] || this.options.orderBy;
12 this.options.limit = this.el.dataset['limit'] || this.options.limit;
13 fetch(`https://gitcoin.co/api/v0.1/bounties/?raw_data=${this.options.repository}&org=${this.options.organization}&network=mainnet&coinbase=unknown&order_by=${this.orderBy()}&limit=${this.limit()}`)
14 .then(response => response.json())
15 .then(json => {
16 this.data = json;
17 this.render();
18 });
19 }
20 orderBy() {
21 return this.options.orderBy ? this.options.orderBy : '-expires_date';
22 }

Callers

nothing calls this directly

Calls 3

orderByMethod · 0.95
limitMethod · 0.95
renderMethod · 0.95

Tested by

no test coverage detected