types
Defines the type, initial value, and get, set, and serialize behavior for an
observable property. All type converters leave null
and undefined
as is except for
the "htmlbool"
type converter.
Object
Use
Use any of the type names on a PropDefinition's type
or directly on the prototype of a DefineMap or DefineList.
var define = require("can-define");
var DefineMap = require("can-define/map/map");
var Animal = function(name){
this.name = name;
};
define(Animal.prototype,{
name: {type: "string"}
});
var Person = DefineMap.extend({
name: "string"
});
You can also pass these functions in directly:
var define = require("can-define");
var DefineMap = require("can-define/map/map");
var Animal = function(name){
this.name = name;
};
define(Animal.prototype,{
name: {type: define.type.string}
});
var Person = DefineMap.extend({
name: define.type.string
});