This file contains hidden or 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 Collection = require("ampersand-rest-collection"); | |
| var Model = require("ampersand-model"); | |
| var Product = Model.extend({ | |
| props: { | |
| name: 'string', | |
| price: 'integer' | |
| } | |
| }); |
This file contains hidden or 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 AmpersandCollection = require('ampersand-collection'); | |
| var AmpersandView = require('ampersand-view'); | |
| var Note = AmpersandModel.extend({ | |
| props: { | |
| text: 'string' | |
| } | |
| }); |
This file contains hidden or 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 AmpersandState = require('ampersand-state'); | |
| var State = AmpersandState.extend({ | |
| props: { | |
| name: 'string' | |
| }, | |
| derived: { | |
| awesomeName: { | |
| deps: ['name'], | |
| fn: function () { |
This file contains hidden or 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 object = { | |
| method: function () { | |
| console.log('foo'); | |
| }, | |
| method2: function () { | |
| $('.button').on('click', function () { | |
| this.method(); | |
| }.bind(this)); | |
| } |
This file contains hidden or 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 Foo = AmpersandView.extend({ | |
| autoRender: true, | |
| initialize: function () { | |
| this.template = '<span></span>'; | |
| } | |
| }); |
This file contains hidden or 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 AmpersandState = require('ampersand-state'); | |
| var AmpersandView = require('ampersand-view'); | |
| var domready = require('domready'); | |
| var MealView = AmpersandView.extend({ | |
| template: '<span data-hook="desc"></span>', | |
| bindings: { | |
| 'model.description': { | |
| type: 'text', | |
| hook: 'desc' |
This file contains hidden or 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
| // example using the raf module from npm. try changing some values! | |
| var requestAnimationFrame = require("raf") | |
| var canvas = document.createElement("canvas") | |
| canvas.width = 500 | |
| canvas.height = 500 | |
| document.body.appendChild(canvas) | |
| var context = canvas.getContext("2d") |
This file contains hidden or 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 AmpersandState = require('ampersand-state'); | |
| var AmpersandView = require('ampersand-view'); | |
| var domready = require('domready'); | |
| var MealView = AmpersandView.extend({ | |
| template: '<span data-hook="desc"></span>', | |
| bindings: { | |
| 'model.description': { | |
| type: 'text', | |
| hook: 'desc' |
This file contains hidden or 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 hidden or 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'] | |
| } | |
| }); |