Skip to content

Instantly share code, notes, and snippets.

View dbauszus-glx's full-sized avatar

Dennis Bauszus dbauszus-glx

View GitHub Profile
dictionary: new Proxy({}, {
get: function(target, key, receiver){
if (mapp.dictionaries[mapp.language][key]) {
return mapp.dictionaries[mapp.language][key]
}
// Return english
return mapp.dictionaries.en[key]
mapp.utils.merge(mapp.dictionaries, {
en: {
location_clear_all: "Clear locations",
},
de: {
location_clear_all: "Entferne Auswahl"
},
cn: {
location_clear_all: "모든 위치 제거",
},
params.mapview.locations = new Proxy(params.mapview.locations, {
set: function(target, key, location){
Reflect.set(...arguments)
// code to add a location view element to the listview element in the DOM.
return true
},
export default plugins => {
if (!Array.isArray(plugins)) return;
return new Promise(resolveAll=>{
const promises = plugins.map(
plugin =>
new Promise((resolve, reject) =>
import(plugin)
document.dispatchEvent(
new CustomEvent("myPlugin", {
detail: (_xyz) => {
console.log(_xyz)
}
}
)
const script = document.createElement("script")
script.type = 'application/javascript'
script.src = 'https://geolytix.github.com/GEOLYTIX/public/blob/v3/public/myPluginScript.js'
let eventTriggered
script.onload = () => {
setTimeout(()=>{
draw.interaction = new ol.interaction.Draw({
source: draw.Layer.getSource(),
geometryFunction: draw.geometryFunction,
freehand: draw.freehand,
type: draw.type,
style: draw.style,
condition: e => {
if (e.originalEvent.buttons === 1) {
draw.vertices.push(e.coordinate);
const compose = (...fns) => {
return arg => fns.reduce((acc, fn) => {
return fn(acc);
}, arg)
}
@dbauszus-glx
dbauszus-glx / mbtiles.mjs
Last active August 19, 2022 17:18
Abstract of the mbtiles mapp format
let promise, maplibregl = null
async function MaplibreGL() {
// maplibre is loaded.
if (maplibregl) return new maplibregl.Map(...arguments);
// create a promise to check for the maplibre library
if (!promise) promise = new Promise(async resolve => {
@dbauszus-glx
dbauszus-glx / hello_world.js
Created August 19, 2022 14:40
Basic usa of the script tag.
<script>
alert("Hello World!");
</script>