This gist shows examples of how to handle different types of form elements with the new stache binding syntax in CanJS 2.3.
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
return new Proxy(this, { | |
get: function(target, prop) { | |
var funcOrProp = target[prop]; | |
if (typeof funcOrProp === 'function') { | |
return function() { | |
var result = funcOrProp.apply(target, arguments); | |
console.log(prop + '(' + [].join.call(arguments, ',') + ') -> ' + JSON.stringify(result)); | |
return result; | |
} |
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 clone from 'steal-clone'; |
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
const npm = require('npm'); | |
const publishTimes = {}; | |
function getInfo(name, version) { | |
return new Promise((resolve) => { | |
npm.info(name, (err, info) => { | |
const times = typeof info[version] === 'object' ? info[version].time : {}; | |
resolve(`${name}@${version}|${times[version]}`);; | |
}); |
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
<script src="../node_modules/steal/steal.js"> | |
window.rerun = true; | |
function rerunIfSuccessful() { | |
var result = document.getElementById('qunit-testresult'); | |
var failed = result.getElementsByClassName('failed'); | |
if (!failed.length) { | |
setTimeout(rerunIfSuccessful, 4000); | |
} else if (failed[0].innerHTML === "0" && window.rerun) { | |
location.reload(true); | |
} |
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 QUnit from 'steal-qunit'; | |
QUnit.module('Tournament Details ViewModel', { | |
beforeEach: function () { | |
localStorage.clear(); | |
} | |
}); | |
test('should load a tournament', (assert) => { | |
let done = assert.async(), |
NewerOlder