web-dom 0.1.1

Simple bindings to the DOM using wasm-module
Documentation
export default function() {
  let allocations = [null];
  let empty = [];
  return {
    //allocate
    a:function(value){
      let i = allocations.length;
      if(empty.length > 0) {
        i = empty.pop();
      }
      allocations[i] = value;
      return i;
    },
    //release
    r(handle){
        allocations[handle] = undefined;
        empty.push(handle);
    },
    //get
    g(handle){
      if(handle < 0){
        return undefined;
      }
      let ret =  allocations[handle];
      if(handle !=0 && !ret){
        console.error(`Asked for ${handle} after it was released.`)
      }
      return ret;
    }
  }
}