UNPKG

can

Version:

MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.

21 lines 523 B
<html> <head></head> <body> <script src="../node_modules/steal/steal.js" main="@empty"></script> <script> steal('can/map/validations','can/model',function(){ var Person = can.Model.extend({ init: function(){ this.validate("birthday",function(birthday){ if(birthday > new Date){ return "your birthday needs to be in the past" } }) } },{}); var p = new Person({birthday: new Date(new Date().getTime()+1000 )}); console.log( p.errors() ); }) </script> </body> </html>