Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//!steal-remove-end
// Call event on the instance's Class
canEvent.dispatch.call(constructor, funcName, [instance]);
};
});
return behavior;
});
var CanModel = CanMap.extend({
setup: function (base, fullName, staticProps, protoProps) {
// Assume `fullName` wasn't passed. (`CanModel.extend({ ... }, { ... })`)
// This is pretty usual.
if (typeof fullName !== "string") {
protoProps = staticProps;
staticProps = fullName;
}
// Assume no static properties were passed. (`CanModel.extend({ ... })`)
// This is really unusual for a model though, since there's so much configuration.
if (!protoProps) {
//!steal-remove-start
dev.warn("can/model/model.js: CanModel extended without static properties.");
//!steal-remove-end
protoProps = staticProps;
}
var Component = require("can-component");
var Map = require("can-map");
var ViewModel = Map.extend({
showThing: false
});
Component.extend({
tag: "home-page",
template: require("./home.stache!"),
ViewModel: ViewModel,
events: {
init: function(){
var vm = this.viewModel;
setTimeout(function(){
vm.attr("showThing", true);
}, 50);
}
}
});
var Component = require("can-component");
var Map = require("can-map");
require("can-map-define");
var List = require("can-list");
var ViewModel = Map.extend({
define: {
things: {
Value: List,
get: function(list){
var xhr = new XMLHttpRequest();
xhr.open("GET", "foo://bar");
xhr.onload = function(){
var data = JSON.parse(xhr.responseText);
list.replace(data);
};
xhr.send();
return list;
}
}
}
});