1

Looking at realtime playground example.

For custom object, there this call:

custom.setInitializer(Movie, Movie.prototype.initialize);

and Movie.prototype.initialize handler takes two parameters name, director

Where or how do these parameters get passed to initialize function?

dev.e.loper
  • 35,446
  • 76
  • 161
  • 247
  • Those arguments will probably be passed to the `Movie.prototype.initialize` function somewhere inside the `setInitializer` function. – basilikum Jul 29 '13 at 15:57
  • 3
    actually this line is probably where it's happening: `var field = model.create(rtpg.custom.Movie, start.name, start.director);` – basilikum Jul 29 '13 at 16:03
  • 1
    Yes, it looks like create function also defines arguments for initialize function. https://developers.google.com/drive/realtime/reference/gapi.drive.realtime.Model#gapi.drive.realtime.Model.prototype.create `* var_args — Arguments to the newly-created object's initialize() method.` – dev.e.loper Jul 29 '13 at 16:08

1 Answers1

1

create function is the one that specifies arguments for initialize function. See definition here

model.create call passes name, director parameters here https://github.com/googledrive/realtime-playground/blob/master/js/rtpg.custom.js#L79

Thank you @basilikum for the tip.

dev.e.loper
  • 35,446
  • 76
  • 161
  • 247