js2cpp.js 287 B

1234567891011121314151617181920
  1. var js2cpp = {
  2. _items:{},
  3. _id:0,
  4. create:function (data, id) {
  5. if (typeof(id) === "undefined")
  6. {
  7. this._id += 1;
  8. id = this._id;
  9. }
  10. this._items[id] = data;
  11. return id;
  12. },
  13. get:function(id){
  14. return this._items[id];
  15. },
  16. free:function(id){
  17. delete this._items[id];
  18. }
  19. };