charting refactor into shapes, not debugged

This commit is contained in:
Tim
2024-02-05 20:02:49 -04:00
parent 5587915728
commit 042f96b37c
13 changed files with 614 additions and 114 deletions

View File

@@ -1,34 +0,0 @@
export function mixin(child, ...parents) {
for( const parent of parents ) {
for ( const key in parent) {
if (parent.hasOwnProperty(key)) {
child[key] = parent[key];
}
}
}
return child;
}
export function prototype(parent, child) {
const result = Object.create(parent);
Object.assign(result, child)
return result
}
export function encodeIEE754(value) {
const buffer = new ArrayBuffer(4);
const view = new DataView(buffer);
view.setFloat32(0, value, false /* big endian */);
return view.getUint32(0, false);
}
export function decodeIEE754(value) {
const buffer = new ArrayBuffer(4);
const view = new DataView(buffer);
view.setUint32(0, value, false)
return view.getFloat32(0, false)
}

View File

@@ -26,7 +26,7 @@ export function subOHLCs( chainId, poolPeriods ) {
socket.emit('subOHLCs', chainId, toSub)
}
export function unsubPrices( chainId, poolPeriods ) {
export function unsubOHLCs( chainId, poolPeriods ) {
const toUnsub = []
for( const [pool,period] of poolPeriods ) {
const key = `${pool}|${period}`

View File

@@ -1,5 +1,5 @@
import {uint32max, uint64max} from "@/misc.js";
import {decodeIEE754, encodeIEE754} from "@/blockchain/common.js";
import {decodeIEE754, encodeIEE754} from "@/common.js";
export const MAX_FRACTION = 65535;
export const NO_CHAIN = uint64max;