Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Gaffa = require('gaffa'),
behaviourType = 'pageLoad';
function PageLoadBehaviour(){}
PageLoadBehaviour = Gaffa.createSpec(PageLoadBehaviour, Gaffa.Behaviour);
PageLoadBehaviour.prototype.type = behaviourType;
PageLoadBehaviour.prototype.bind = function(){
this.gaffa.actions.trigger(this.actions.load, this);
};
module.exports = PageLoadBehaviour;
var Gaffa = require('gaffa'),
actionType = "fromJson";
function FromJson(){}
FromJson = Gaffa.createSpec(FromJson, Gaffa.Action);
FromJson.prototype.type = actionType;
FromJson.prototype.trigger = function(){
this.target.set(JSON.parse(this.source.value), this);
};
FromJson.prototype.target = new Gaffa.Property();
FromJson.prototype.source = new Gaffa.Property();
module.exports = FromJson;
psudoParent.parent = this;
psudoParent.sourcePath = keys ? keys[i] : '' + i;
var actions = JSON.parse(JSON.stringify(this.actions['forEach']));
psudoParent.actions.all = actions;
psudoParent = this.gaffa.initialiseViewItem(psudoParent, psudoParent.gaffa, psudoParent.actions.constructors);
scope.item = items[i];
psudoParent.triggerActions('all', scope, event);
}
};
function EachPsudoParent(){}
EachPsudoParent = Gaffa.createSpec(EachPsudoParent, Gaffa.Action);
EachPsudoParent.prototype.type = 'eachPsudoParent';
module.exports = ForEach;
var Gaffa = require('gaffa'),
crel = require('crel'),
viewType = "switchContainer",
cachedElement;
function SwitchContainer(){}
SwitchContainer = Gaffa.createSpec(SwitchContainer, Gaffa.ContainerView);
SwitchContainer.prototype.type = viewType;
SwitchContainer.prototype.render = function(){
var renderedElement = crel(this.tagName || 'div');
this.views.content.element = renderedElement;
this.renderedElement = renderedElement;
};
function createNewView(property, template, templateKey){
if(!property.templateCache){
property.templateCache= {};
}
var view = JSON.parse(
var Gaffa = require('gaffa'),
behaviourType = 'modelChange';
function executeBehaviour(behaviour, value){
behaviour.gaffa.actions.trigger(behaviour.actions.change, behaviour);
}
function ModelChangeBehaviour(){}
ModelChangeBehaviour = Gaffa.createSpec(ModelChangeBehaviour, Gaffa.Behaviour);
ModelChangeBehaviour.prototype.type = behaviourType;
ModelChangeBehaviour.prototype.condition = new Gaffa.Property({value: true});
ModelChangeBehaviour.prototype.watch = new Gaffa.Property({
update: function(behaviour, value){
var gaffa = behaviour.gaffa;
if(!behaviour.condition.value){
return;
}
var throttleTime = behaviour.throttle;
if(!isNaN(throttleTime)){
var now = new Date();
if(!behaviour.lastTrigger || now - behaviour.lastTrigger > throttleTime){
behaviour.lastTrigger = now;
executeBehaviour(behaviour, value);
var Gaffa = require('gaffa'),
actionType = "toJson";
function ToJson(){}
ToJson = Gaffa.createSpec(ToJson, Gaffa.Action);
ToJson.prototype.type = actionType;
ToJson.prototype.trigger = function(){
this.target.set(JSON.stringify(this.source.value), this);
};
ToJson.prototype.target = new Gaffa.Property();
ToJson.prototype.source = new Gaffa.Property();
module.exports = ToJson;
var Gaffa = require('gaffa'),
actionType = "toggle";
function Toggle(){}
Toggle = Gaffa.createSpec(Toggle, Gaffa.Action);
Toggle.prototype.type = actionType;
Toggle.prototype.trigger = function(){
this.target.set(!this.target.value, this);
};
Toggle.prototype.target = new Gaffa.Property();
module.exports = Toggle;
var Gaffa = require('gaffa'),
actionType = "switch";
function Switch(){}
Switch = Gaffa.createSpec(Switch, Gaffa.Action);
Switch.prototype.type = actionType;
Switch.prototype['switch'] = new Gaffa.Property();
Switch.prototype.trigger = function(parent, scope, event) {
if(this['switch'].value != null){
this.triggerActions(this['switch'].value, scope, event);
}
};
module.exports = Switch;
var Gaffa = require('gaffa'),
behaviourType = 'navigate';
function Navigate(){}
Navigate = Gaffa.createSpec(Navigate, Gaffa.Behaviour);
Navigate.prototype.type = behaviourType;
Navigate.prototype.bind = function(){
var behaviour = this;
this.gaffa.notifications.add('navigation', function(){
behaviour.gaffa.actions.trigger(behaviour.actions.navigate, behaviour);
});
};
module.exports = Navigate;
var Gaffa = require('gaffa');
function Container(){}
Container = Gaffa.createSpec(Container, Gaffa.ContainerView);
Container.prototype.type = 'container';
Container.prototype.render = function(){
this.views.content.element =
this.renderedElement =
document.createElement(this.tagName || 'div');
};
module.exports = Container;