rename Type methods: s/toString/stringify and s/fromString/parse to avoid clash with built in meaning for toString. Also add lots of documentation, a new DeferredType, and lots more checks to how types are created

This commit is contained in:
Joe Walker 2010-12-02 10:59:20 +00:00
commit e544ad30fc
3 changed files with 137 additions and 54 deletions

View file

@ -240,7 +240,7 @@ Settings.prototype = {
if (data.hasOwnProperty(key)) {
var setting = this._settings[key];
if (setting) {
var value = setting.type.fromString(data[key]);
var value = setting.type.parse(data[key]);
this.set(key, value);
} else {
this.set(key, data[key]);
@ -254,7 +254,7 @@ Settings.prototype = {
*/
_saveToObject: function() {
return this.getSettingNames().map(function(key) {
return this._settings[key].type.toString(this.get(key));
return this._settings[key].type.stringify(this.get(key));
}.bind(this));
},