js2cpp.js 470 B

1234567891011121314151617181920212223242526272829
  1. var js2cppX = function(){
  2. return {
  3. _items:{},
  4. _id:0,
  5. create:function (data, id) {
  6. if (typeof(id) === "undefined")
  7. {
  8. this._id += 1;
  9. id = this._id;
  10. }
  11. this._items[id] = data;
  12. return id;
  13. },
  14. get:function(id){
  15. return this._items[id];
  16. },
  17. free:function(id){
  18. delete this._items[id];
  19. },
  20. get_size:function(){
  21. return Object.keys(this._items).length;
  22. }
  23. };
  24. };
  25. var js2cpp = js2cppX();