Skip to content

Commit 687173c

Browse files
committed
Updated links for release.
1 parent 8bf3acd commit 687173c

7 files changed

Lines changed: 296 additions & 2 deletions

File tree

docs/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253

254254
<!-- Note the usage of `type=module` here as this is an ES6 module -->
255255
<script type="module">
256-
import init, { greet, analyze_gpx, analyze_tcx } from '../../activity-analyzer/pkg/activity_analyzer.js';
256+
import init, { greet, analyze_gpx, analyze_tcx } from 'https://activity-analyzer.app/pkg/activity_analyzer.js';
257257

258258
async function run() {
259259
await init();

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919

2020
<body>
2121

22-
<img src="https://run-everywhere.com/images/under_construction.png" alt="Under Construction">
22+
<meta http-equiv="Refresh" content="0; url='https://activity-analyzer.app/html/'" />
2323

2424
</body>

docs/pkg/activity_analyzer.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
*/
5+
export function greet(): void;
6+
/**
7+
* @param {string} s
8+
* @returns {string}
9+
*/
10+
export function analyze_gpx(s: string): string;
11+
/**
12+
* @param {string} s
13+
* @returns {string}
14+
*/
15+
export function analyze_tcx(s: string): string;
16+
17+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
18+
19+
export interface InitOutput {
20+
readonly memory: WebAssembly.Memory;
21+
readonly greet: () => void;
22+
readonly analyze_gpx: (a: number, b: number, c: number) => void;
23+
readonly analyze_tcx: (a: number, b: number, c: number) => void;
24+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
25+
readonly __wbindgen_malloc: (a: number) => number;
26+
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
27+
readonly __wbindgen_free: (a: number, b: number) => void;
28+
}
29+
30+
/**
31+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
32+
* for everything else, calls `WebAssembly.instantiate` directly.
33+
*
34+
* @param {InitInput | Promise<InitInput>} module_or_path
35+
*
36+
* @returns {Promise<InitOutput>}
37+
*/
38+
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;

docs/pkg/activity_analyzer.js

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
2+
let wasm;
3+
4+
const heap = new Array(32).fill(undefined);
5+
6+
heap.push(undefined, null, true, false);
7+
8+
function getObject(idx) { return heap[idx]; }
9+
10+
let heap_next = heap.length;
11+
12+
function dropObject(idx) {
13+
if (idx < 36) return;
14+
heap[idx] = heap_next;
15+
heap_next = idx;
16+
}
17+
18+
function takeObject(idx) {
19+
const ret = getObject(idx);
20+
dropObject(idx);
21+
return ret;
22+
}
23+
24+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
25+
26+
cachedTextDecoder.decode();
27+
28+
let cachegetUint8Memory0 = null;
29+
function getUint8Memory0() {
30+
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
31+
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
32+
}
33+
return cachegetUint8Memory0;
34+
}
35+
36+
function getStringFromWasm0(ptr, len) {
37+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
38+
}
39+
/**
40+
*/
41+
export function greet() {
42+
wasm.greet();
43+
}
44+
45+
let WASM_VECTOR_LEN = 0;
46+
47+
let cachedTextEncoder = new TextEncoder('utf-8');
48+
49+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
50+
? function (arg, view) {
51+
return cachedTextEncoder.encodeInto(arg, view);
52+
}
53+
: function (arg, view) {
54+
const buf = cachedTextEncoder.encode(arg);
55+
view.set(buf);
56+
return {
57+
read: arg.length,
58+
written: buf.length
59+
};
60+
});
61+
62+
function passStringToWasm0(arg, malloc, realloc) {
63+
64+
if (realloc === undefined) {
65+
const buf = cachedTextEncoder.encode(arg);
66+
const ptr = malloc(buf.length);
67+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
68+
WASM_VECTOR_LEN = buf.length;
69+
return ptr;
70+
}
71+
72+
let len = arg.length;
73+
let ptr = malloc(len);
74+
75+
const mem = getUint8Memory0();
76+
77+
let offset = 0;
78+
79+
for (; offset < len; offset++) {
80+
const code = arg.charCodeAt(offset);
81+
if (code > 0x7F) break;
82+
mem[ptr + offset] = code;
83+
}
84+
85+
if (offset !== len) {
86+
if (offset !== 0) {
87+
arg = arg.slice(offset);
88+
}
89+
ptr = realloc(ptr, len, len = offset + arg.length * 3);
90+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
91+
const ret = encodeString(arg, view);
92+
93+
offset += ret.written;
94+
}
95+
96+
WASM_VECTOR_LEN = offset;
97+
return ptr;
98+
}
99+
100+
let cachegetInt32Memory0 = null;
101+
function getInt32Memory0() {
102+
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
103+
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
104+
}
105+
return cachegetInt32Memory0;
106+
}
107+
/**
108+
* @param {string} s
109+
* @returns {string}
110+
*/
111+
export function analyze_gpx(s) {
112+
try {
113+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
114+
var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
115+
var len0 = WASM_VECTOR_LEN;
116+
wasm.analyze_gpx(retptr, ptr0, len0);
117+
var r0 = getInt32Memory0()[retptr / 4 + 0];
118+
var r1 = getInt32Memory0()[retptr / 4 + 1];
119+
return getStringFromWasm0(r0, r1);
120+
} finally {
121+
wasm.__wbindgen_add_to_stack_pointer(16);
122+
wasm.__wbindgen_free(r0, r1);
123+
}
124+
}
125+
126+
/**
127+
* @param {string} s
128+
* @returns {string}
129+
*/
130+
export function analyze_tcx(s) {
131+
try {
132+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133+
var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
134+
var len0 = WASM_VECTOR_LEN;
135+
wasm.analyze_tcx(retptr, ptr0, len0);
136+
var r0 = getInt32Memory0()[retptr / 4 + 0];
137+
var r1 = getInt32Memory0()[retptr / 4 + 1];
138+
return getStringFromWasm0(r0, r1);
139+
} finally {
140+
wasm.__wbindgen_add_to_stack_pointer(16);
141+
wasm.__wbindgen_free(r0, r1);
142+
}
143+
}
144+
145+
function addHeapObject(obj) {
146+
if (heap_next === heap.length) heap.push(heap.length + 1);
147+
const idx = heap_next;
148+
heap_next = heap[idx];
149+
150+
heap[idx] = obj;
151+
return idx;
152+
}
153+
154+
async function load(module, imports) {
155+
if (typeof Response === 'function' && module instanceof Response) {
156+
if (typeof WebAssembly.instantiateStreaming === 'function') {
157+
try {
158+
return await WebAssembly.instantiateStreaming(module, imports);
159+
160+
} catch (e) {
161+
if (module.headers.get('Content-Type') != 'application/wasm') {
162+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
163+
164+
} else {
165+
throw e;
166+
}
167+
}
168+
}
169+
170+
const bytes = await module.arrayBuffer();
171+
return await WebAssembly.instantiate(bytes, imports);
172+
173+
} else {
174+
const instance = await WebAssembly.instantiate(module, imports);
175+
176+
if (instance instanceof WebAssembly.Instance) {
177+
return { instance, module };
178+
179+
} else {
180+
return instance;
181+
}
182+
}
183+
}
184+
185+
async function init(input) {
186+
if (typeof input === 'undefined') {
187+
input = new URL('activity_analyzer_bg.wasm', import.meta.url);
188+
}
189+
const imports = {};
190+
imports.wbg = {};
191+
imports.wbg.__wbg_alert_e9e2360dc670aa7a = function(arg0, arg1) {
192+
alert(getStringFromWasm0(arg0, arg1));
193+
};
194+
imports.wbg.__wbg_new_59cb74e423758ede = function() {
195+
var ret = new Error();
196+
return addHeapObject(ret);
197+
};
198+
imports.wbg.__wbg_stack_558ba5917b466edd = function(arg0, arg1) {
199+
var ret = getObject(arg1).stack;
200+
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
201+
var len0 = WASM_VECTOR_LEN;
202+
getInt32Memory0()[arg0 / 4 + 1] = len0;
203+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
204+
};
205+
imports.wbg.__wbg_error_4bb6c2a97407129a = function(arg0, arg1) {
206+
try {
207+
console.error(getStringFromWasm0(arg0, arg1));
208+
} finally {
209+
wasm.__wbindgen_free(arg0, arg1);
210+
}
211+
};
212+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
213+
takeObject(arg0);
214+
};
215+
216+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
217+
input = fetch(input);
218+
}
219+
220+
221+
222+
const { instance, module } = await load(await input, imports);
223+
224+
wasm = instance.exports;
225+
init.__wbindgen_wasm_module = module;
226+
227+
return wasm;
228+
}
229+
230+
export default init;
231+

docs/pkg/activity_analyzer_bg.wasm

470 KB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
export const memory: WebAssembly.Memory;
4+
export function greet(): void;
5+
export function analyze_gpx(a: number, b: number, c: number): void;
6+
export function analyze_tcx(a: number, b: number, c: number): void;
7+
export function __wbindgen_add_to_stack_pointer(a: number): number;
8+
export function __wbindgen_malloc(a: number): number;
9+
export function __wbindgen_realloc(a: number, b: number, c: number): number;
10+
export function __wbindgen_free(a: number, b: number): void;

docs/pkg/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "activity-analyzer",
3+
"collaborators": [
4+
"Mike Simms <msimms01@gmail.com>"
5+
],
6+
"version": "0.1.0",
7+
"files": [
8+
"activity_analyzer_bg.wasm",
9+
"activity_analyzer.js",
10+
"activity_analyzer.d.ts"
11+
],
12+
"module": "activity_analyzer.js",
13+
"types": "activity_analyzer.d.ts",
14+
"sideEffects": false
15+
}

0 commit comments

Comments
 (0)