My 2 cents for what they are worth and to coin an old phrase, "We are trying to put a square peg into a round hole." Although it was interesting going through some of the above, creative if not hacky or sketchy work arounds, the simple answer surely has to be that until we get native support, we are just going to have to stick to the tried and tested methods of transferring our data. Although there would be some scenarios where if you were the creator of the map you would write your code in a separate 'src' file and save a copy as a .txt file and, if written concisely enough, could easily be read in, deciphered, and added to server-side. the
The new file would then be saved as a .js and a reference to it sent back from the server. The file would then reconstruct it selfitself perfectly once read back in as .jsJS. The beauty being that no hacky iterating or parsing is required for reconstruction.