Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
CommonStrata.user,
"layers",
"nasa-black-marble:dnb_land_ocean_ice.2012.54000x27000_geo"
);
blackMarble.setTrait(CommonStrata.user, "opacity", 1.0);
blackMarble.loadMapItems();
});
result.push(
new BaseMapViewModel(
blackMarble,
require("../../wwwroot/images/black-marble.png")
)
);
const positron = new OpenStreetMapCatalogItem("basemap-positron", terria);
runInAction(() => {
positron.setTrait(CommonStrata.user, "name", "Positron (Light)");
positron.setTrait(
CommonStrata.user,
"url",
"https://global.ssl.fastly.net/light_all/"
);
// https://cartodb.com/basemaps/ gives two different attribution strings. In any case HTML gets swallowed, so we have to adapt.
// 1 '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, ©
// <a href="http://cartodb.com/attributions">CartoDB</a>'
// 2 Map tiles by <a href="http://cartodb.com/attributions#basemaps">CartoDB</a>, under <a href="https://creativecommons.org/licenses/by/3.0/">
// CC BY 3.0</a>. Data by <a href="http://www.openstreetmap.org/">OpenStreetMap</a>, under ODbL.
positron.setTrait(
CommonStrata.user,
"attribution",
"© OpenStreetMap contributors ODbL, © CartoDB CC-BY 3.0"
then(resolve: (t: T) => R, reject?: (error: any) => any): LulPromise {
if (this.data) {
// resolve instantly without waiting for call stack to empty
const nextVal = resolve(this.data);
const nextLul = new LulPromise(Promise.resolve(nextVal));
if (typeof nextVal === "object" && typeof (nextVal as any)["then"] !== "function") {
mobx.runInAction("then()", () => nextLul.data = nextVal);
}
return nextLul;
} else {
return new LulPromise(this.promise.then(resolve, reject));
}
}
}
updateRoutes(routes: Route<*, *>[]) {
runInAction(() => {
this.prevRoutes.replace(this.routes.slice())
this.routes.replace(routes)
// Update params
this.params.clear()
this.routes.forEach(route => {
this.params.set(route.node.value.key, route.params)
})
})
}
public async edit({ name, avatarUrl }: { name: string; avatarUrl: string }) {
try {
const { slug } = await updateTeam({
teamId: this._id,
name,
avatarUrl,
});
runInAction(() => {
this.name = name;
this.slug = slug;
this.avatarUrl = avatarUrl;
});
} catch (error) {
console.error(error);
throw error;
}
}
@action async fetchNotifications() {
try {
const notifications = await textile.notifications.list()
const processed = notifications.items.map((item) => {
item.user.avatar = item.user.avatar
? `${this.gateway}/ipfs/${item.user.avatar}/0/small/content`
: DEFAULT_AVATAR
return item
})
runInAction('fetchNotifications', () => {
this.notifications = processed
})
} catch (err) {
console.log(err)
}
}
@action async readNotification(id: string) {
public async createCustomer({ token }: { token: object }) {
try {
const { hasCardInformation, stripeCard } = await createCustomerApiMethod({
token,
});
runInAction(() => {
this.hasCardInformation = hasCardInformation;
this.stripeCard = stripeCard;
});
} catch (error) {
console.error(error);
throw error;
}
}
function getToast() {
if (!toastModule) {
toastModule = require("react-toastify") as typeof ToastModule;
const ToastContainer = toastModule.ToastContainer;
runInAction(() => {
container.set(
);
});
}
return toastModule.toast;
}
async getData() {
const json = await this.context.admin.getJSON("/api/tags.json")
runInAction(() => {
this.tags = json.tags
})
}
try {
const response = await fetch(url, {
method: 'post',
body: JSON.stringify({
queryText: this.queryText,
dateFilter: this.dateFilter instanceof Array
? null
: this.dateFilter,
dateRangeFilter: this.dateFilter instanceof Array
? this.dateFilter.map(d => formatServerDate(d))
: null,
levelFilter: this.levelFilter,
exceptionsOnly: this.exceptionsOnly,
})
});
runInAction('set loading finished', () => this.loading = false);
if (!response.ok) {
if (this.onEventsLoadError) {
this.onEventsLoadError(response);
}
return;
}
const events = await response.json() as ILogEntry[];
if (events.length) {
if (!this.startingTimestamp) {
this.startingTimestamp = events[0].timestamp;
}
runInAction('load entries', () => this.logEntries = this.logEntries.concat(events));