This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AmpCollection = require('ampersand-rest-collection'); | |
var AmpModel = require('ampersand-model'); | |
var Photo = AmpModel.extend({ | |
props: { | |
aperture: ['string'], | |
camera: ['string'] | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var View = require('ampersand-view'); | |
var Model = require('ampersand-model'); | |
var Collection = require('ampersand-collection'); | |
var myView = View.extend({ | |
template: '<div data-hook="created-author"></div>', | |
bindings: { | |
'model.owner.name': { | |
hook: 'created-author' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AmpersandCollection = require('ampersand-collection'); | |
var Collection = AmpersandCollection.extend({}); | |
var collection = new Collection(); | |
console.log(collection.length); // 0 | |
console.log(collection.models.length); // 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var State = require('ampersand-state'); | |
var X = State.extend({ | |
props: { | |
foo: 'number' | |
}, | |
derived: { | |
bar: { | |
deps: ['foo'], | |
fn: function() { return this.foo + 1; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Model = require('ampersand-model'); | |
var View = require('ampersand-view'); | |
var domready = require('domready'); | |
var ChildModel = Model.extend({ | |
props: { | |
id: 'number' | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
.btn { | |
color: red; | |
} | |
.add, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AmpersandView = require('ampersand-view'); | |
var AppSubView = AmpersandView.extend({ | |
template: '<button data-hook=someEvent>Triggerme</button>', | |
events: { | |
'click [data-hook=someEvent]': 'someEventHandler' | |
}, | |
someEventHandler: function () { | |
console.log('you triggered me!'); | |
this.parent.parentHandler(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AmpersandModel = require('ampersand-model'); | |
var Model = AmpersandModel.extend({ | |
props: { | |
name: 'string', | |
greetingType: ['string', true, 'long'] | |
}, | |
derived: { | |
greeting: { | |
deps: ['name', 'greetingType'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isSupportingCSSAnimations () { | |
var prefixes = ['Webkit', 'Moz', 'O', 'ms', 'Khtml']; | |
var el = document.createElement('div'); | |
if (el.style.animationName !== undefined) { | |
return true; | |
} | |
return prefixes.some(function (prefix) { | |
return el.style[prefix + 'AnimationName'] !== undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Mixin.create({ | |
serializeQueryParam(value, urlKey, defaultValueType) { | |
if (defaultValueType === 'array') { | |
return value; | |
} else { | |
return this._super.call(this, ...arguments); | |
} | |
}, |