@globalfishingwatch/layer-composer
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -20,4 +20,2 @@ "use strict"; | ||
var tilebelt_1 = __importDefault(require("@mapbox/tilebelt")); | ||
// TODO use different tsconfig to include worker types here | ||
// declare const self: ServiceWorkerGlobalScope | ||
var FAST_TILES_KEY = '__fast_tiles__'; | ||
@@ -35,21 +33,2 @@ var FAST_TILES_KEY_RX = new RegExp(FAST_TILES_KEY); | ||
}; | ||
self.addEventListener('install', function () { | ||
console.log('install sw'); | ||
// cleaning up old cache values... | ||
}); | ||
self.addEventListener('activate', function (event) { | ||
console.log('activate sw_'); | ||
// self.clients.claim() | ||
// const allClients = clients.matchAll({ | ||
// includeUncontrolled: true | ||
// }).then((a) => { | ||
// console.log(a) | ||
// }); | ||
// Claim control of clients right after activating | ||
// This allows | ||
event.waitUntil(self.clients.claim().then(function () { | ||
console.log('Now ready to handle fetches?'); | ||
})); | ||
console.log('Now ready to handle fetches!'); | ||
}); | ||
var aggregateIntArray = function (intArray, options) { | ||
@@ -84,2 +63,12 @@ var geomType = options.geomType, numCells = options.numCells, delta = options.delta, x = options.x, y = options.y, z = options.z, quantizeOffset = options.quantizeOffset, singleFrameStart = options.singleFrameStart; | ||
}; | ||
self.addEventListener('install', function () { | ||
console.log('Install sw with skip waiting'); | ||
self.skipWaiting(); | ||
}); | ||
self.addEventListener('activate', function (event) { | ||
console.log('Now ready to handle fetches?'); | ||
event.waitUntil(self.clients.claim().then(function () { | ||
console.log('Now ready to handle fetches!'); | ||
})); | ||
}); | ||
self.addEventListener('fetch', function (fetchEvent) { | ||
@@ -86,0 +75,0 @@ var originalUrl = fetchEvent.request.url; |
@@ -11,2 +11,3 @@ "use strict"; | ||
var BASEMAP_VECTOR_SOURCE = 'basemap_vector'; | ||
exports.DEFAULT_LANDMASS_COLOR = '#203560'; | ||
exports.layers = (_a = {}, | ||
@@ -30,3 +31,3 @@ _a[exports.BASEMAPS.Satellite] = { | ||
paint: { | ||
'fill-color': '#203560', | ||
'fill-color': exports.DEFAULT_LANDMASS_COLOR, | ||
'fill-opacity': 0.99, | ||
@@ -33,0 +34,0 @@ }, |
@@ -21,4 +21,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var basemap_layers_1 = require("../basemap/basemap-layers"); | ||
exports.VESSEL_EVENTS_TYPE = 'VESSEL_EVENTS'; | ||
var BASEMAP_COLOR = '#00265c'; | ||
var VesselsEventsGenerator = /** @class */ (function () { | ||
@@ -91,3 +91,3 @@ function VesselsEventsGenerator() { | ||
'circle-stroke-width': 2, | ||
'circle-stroke-color': __spreadArrays(activeFilter, ['rgba(0, 193, 231, 1)', BASEMAP_COLOR]), | ||
'circle-stroke-color': __spreadArrays(activeFilter, ['rgba(0, 193, 231, 1)', basemap_layers_1.DEFAULT_LANDMASS_COLOR]), | ||
'circle-radius': __spreadArrays(activeFilter, [12, 5]), | ||
@@ -94,0 +94,0 @@ }, |
@@ -8,3 +8,4 @@ import { Dictionary } from '../../../types'; | ||
}; | ||
export declare const DEFAULT_LANDMASS_COLOR = "#203560"; | ||
export declare const layers: Dictionary<Layer>; | ||
export declare const sources: Dictionary<AnySourceImpl>; |
{ | ||
"name": "@globalfishingwatch/layer-composer", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Tools to convert layer configuration to data structures needed in Mapbox GL GFW interactive maps ", | ||
@@ -26,3 +26,2 @@ "keywords": [ | ||
"lint": "eslint -c .eslintrc src/**/*.ts test/*.ts --fix", | ||
"prebuild": "rimraf ./dist/*", | ||
"build": "cross-env NODE_ENV=production tsc --module commonjs && rollup -c rollup.config.ts", | ||
@@ -33,2 +32,3 @@ "typedoc": "typedoc --out docs --target es6 --theme minimal --mode file src", | ||
"release:patch": "release patch", | ||
"prebuild": "rimraf ./dist/*", | ||
"prepublish": "npm run build", | ||
@@ -35,0 +35,0 @@ "publishdoc": "npm run typedoc && npm run gh-pages" |
@@ -12,3 +12,4 @@ /* eslint no-restricted-globals: "off" */ | ||
// TODO use different tsconfig to include worker types here | ||
// declare const self: ServiceWorkerGlobalScope | ||
// it needs to include "workers" as lib but can't overlap with "dom" | ||
declare const self: any | ||
@@ -30,27 +31,2 @@ const FAST_TILES_KEY = '__fast_tiles__' | ||
self.addEventListener('install', () => { | ||
console.log('install sw') | ||
// cleaning up old cache values... | ||
}) | ||
self.addEventListener('activate', (event: any) => { | ||
console.log('activate sw_') | ||
// self.clients.claim() | ||
// const allClients = clients.matchAll({ | ||
// includeUncontrolled: true | ||
// }).then((a) => { | ||
// console.log(a) | ||
// }); | ||
// Claim control of clients right after activating | ||
// This allows | ||
event.waitUntil( | ||
(self as any).clients.claim().then(() => { | ||
console.log('Now ready to handle fetches?') | ||
}) | ||
) | ||
console.log('Now ready to handle fetches!') | ||
}) | ||
const aggregateIntArray = (intArray: any, options: any) => { | ||
@@ -88,2 +64,17 @@ const { geomType, numCells, delta, x, y, z, quantizeOffset, singleFrameStart } = options | ||
self.addEventListener('install', () => { | ||
console.log('Install sw with skip waiting') | ||
self.skipWaiting() | ||
}) | ||
self.addEventListener('activate', (event: any) => { | ||
console.log('Now ready to handle fetches?') | ||
event.waitUntil( | ||
self.clients.claim().then(() => { | ||
console.log('Now ready to handle fetches!') | ||
}) | ||
) | ||
}) | ||
self.addEventListener('fetch', (fetchEvent: any) => { | ||
@@ -133,3 +124,3 @@ const originalUrl = fetchEvent.request.url | ||
const cachePromise = self.caches.match(finalReq).then((cacheResponse) => { | ||
const cachePromise = self.caches.match(finalReq).then((cacheResponse: any) => { | ||
const now = new Date().getTime() | ||
@@ -141,3 +132,3 @@ const cachedTimestamp = | ||
if (hasRecentCache && cacheResponse) { | ||
return cacheResponse.arrayBuffer().then((ab) => { | ||
return cacheResponse.arrayBuffer().then((ab: any) => { | ||
const intArray = new Uint16Array(ab) | ||
@@ -174,3 +165,3 @@ const aggregated = aggregateIntArray(intArray, aggregateParams) | ||
}) | ||
self.caches.open(CACHE_NAME).then((cache) => { | ||
self.caches.open(CACHE_NAME).then((cache: any) => { | ||
cache.put(finalReq, cacheResponse) | ||
@@ -187,3 +178,4 @@ }) | ||
}) | ||
fetchEvent.respondWith(cachePromise) | ||
}) |
@@ -11,2 +11,3 @@ import { Group, Dictionary } from '../../../types' | ||
const BASEMAP_VECTOR_SOURCE = 'basemap_vector' | ||
export const DEFAULT_LANDMASS_COLOR = '#203560' | ||
@@ -31,3 +32,3 @@ export const layers: Dictionary<Layer> = { | ||
paint: { | ||
'fill-color': '#203560', | ||
'fill-color': DEFAULT_LANDMASS_COLOR, | ||
'fill-opacity': 0.99, | ||
@@ -34,0 +35,0 @@ }, |
@@ -5,2 +5,3 @@ import { GeneratorConfig } from 'layer-composer/types' | ||
import { Dictionary } from 'types' | ||
import { DEFAULT_LANDMASS_COLOR } from '../basemap/basemap-layers' | ||
@@ -21,4 +22,2 @@ export const VESSEL_EVENTS_TYPE = 'VESSEL_EVENTS' | ||
const BASEMAP_COLOR = '#00265c' | ||
class VesselsEventsGenerator { | ||
@@ -96,3 +95,3 @@ type = VESSEL_EVENTS_TYPE | ||
'circle-stroke-width': 2, | ||
'circle-stroke-color': [...activeFilter, 'rgba(0, 193, 231, 1)', BASEMAP_COLOR], | ||
'circle-stroke-color': [...activeFilter, 'rgba(0, 193, 231, 1)', DEFAULT_LANDMASS_COLOR], | ||
'circle-radius': [...activeFilter, 12, 5], | ||
@@ -99,0 +98,0 @@ }, |
{ | ||
"include": [ "src" ], | ||
"include": ["src"], | ||
"compilerOptions": { | ||
@@ -7,3 +7,3 @@ "baseUrl": "./src", | ||
"target": "es5", | ||
"module":"es2015", | ||
"module": "es2015", | ||
"lib": ["es2015", "es2016", "es2017", "es2019", "dom"], | ||
@@ -19,11 +19,7 @@ "strict": true, | ||
"outDir": "dist/lib", | ||
"typeRoots": [ | ||
"node_modules/@types", | ||
], | ||
"typeRoots": ["node_modules/@types"], | ||
"paths": { | ||
"lodash/*": [ | ||
"node_modules/@types/lodash-es/*" | ||
], | ||
}, | ||
"lodash/*": ["node_modules/@types/lodash-es/*"] | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1874676
14069