callback особенности
var Vi = function() { reader = null; manifest = null; } Vi.prototype.get = function() { this.reader = new Reader(); this.reader.getFileManifest(url, this.choise); //its callback } Vi.prototype.choise = function(manifest) { this.manifest = manifest; //присваивает не Vi.manifest, а windows.manifest } var Reader = function() {}; Reader.prototype.getFileManifest = function(url, callback); { var manifest = {}; //get manifest from url callback(manifest); } Как область видимости изменить на нужную? //присваивает не Vi.manifest, а windows.manifest |
higimo,
Надо добавить this в конструктор Vi, иначе объявляете глобальные переменные var Vi = function() { this.reader = null; this.manifest = null; } |
Часовой пояс GMT +3, время: 00:31. |