javascript - External library (AJV) is not recognized when using Dojo -


i'm trying use json schema validator (ajv) , sample code provided works fine in jsfiddle when use plain java script this

ajv test - jsfiddle no library (pure javascript)

var ajv = ajv({allerrors: true});  var schema = {   "properties": {     "foo": { "type": "string" },     "bar": { "type": "number", "maximum": 3 }   } };  var validate = ajv.compile(schema);  test({"foo": "abc", "bar": 2}); test({"foo": 2, "bar": 4});  function test(data) {   var valid = validate(data);   if (valid) console.log('valid!');   else console.log('invalid: ' + ajv.errorstext(validate.errors)); } 

but when try use same exact code above in conjunction dojo

ajv test - jsfiddle using dojo 1.10.4

i error

fiddle.jshell.net/pbq2yjxy/18/show/:50 uncaught referenceerror: ajv not defined

how can use ajv library dojo?

global require supplied browserify, conflicts dojo. solution load ajv before dojo. it's resolved here: https://github.com/epoberezkin/ajv/issues/234


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -