Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:hay/stapes

  • Loading branch information...
commit b6cf6d2a9ed20de348c579e64694443adff72b4d 2 parents bc82948 + 036b435
@hay authored
Showing with 15 additions and 9 deletions.
  1. +11 −5 index.html
  2. +1 −1  package.json
  3. +1 −1  stapes.js
  4. +2 −2 stapes.min.js
View
16 index.html
@@ -31,11 +31,11 @@
<h3 id="m-downloads">Downloads</h3>
<ul>
<li><a href="stapes.min.js">
- Download production version 0.4 (minified)</a>
+ Download production version 0.5 (minified)</a>
</li>
- <li><a href="https://github.com/hay/stapes/zipball/v0.4">
- Download development version 0.4 (full source and annotated examples)</a>
+ <li><a href="https://github.com/hay/stapes/zipball/v0.5">
+ Download development version 0.5 (full source and annotated examples)</a>
</li>
<li><a href="http://github.com/hay/stapes">Fork it and report bugs on Github</a>
@@ -70,7 +70,8 @@ <h3 id="m-phil">Philosophy</h3>
<p>Here's a list:</p>
<ul>
<li>A powerful yet simple event system using <a href="#m-on"><code>on</code></a> and
- <a href="#m-emit"><code>emit</code></a> methods. Usable on non-Stapes objects as well.</li>
+ <a href="#m-emit"><code>emit</code></a> methods. Usable on non-Stapes objects as well using
+ <a href="#m-mixinEvents">event mixins</a>.</li>
<li>Inheritance using <a href="#m-create"><code>create</code></a> and
<a href="#m-extend"><code>extend</code></a>.</li>
<li>Event-triggering attributes using <a href="#m-get"><code>get</code></a> and <a href="#m-set"><code>set</code></a>.</li>
@@ -203,6 +204,9 @@ <h3 id="m-examples">Examples</h3>
<p>Code for these examples is available in the <a href="#m-downloads">development download</a>.</p>
+ <p>Note that the two todo examples are also available from
+ <a href="http://addyosmani.github.com/todomvc/labs/">TodoMVC</a>.</p>
+
<h3 id="m-general">General methods</h3>
<article id="m-create">
<h1>create</h1>
@@ -1109,7 +1113,7 @@ <h3 id="m-bugs">Bugs and known limitations</h3>
<h3 id="m-history">History</h3>
<ul>
- <li>0.5</li>
+ <li>0.5 - July 2nd 2012</li>
<ul>
<li><small>Feature</small> Add event to any method using the <a href="#m-mixinEvents"><code>mixinEvents</code></a>
method</li>
@@ -1157,6 +1161,8 @@ <h3 id="m-contributors">Contributors</h3>
<li><a href="https://github.com/frenkie">Frank Bosma</a></li>
<li><a href="https://github.com/adie">Anton Dieterle</a></li>
<li><a href="https://github.com/hogart">Hogart</a></li>
+ <li><a href="https://github.com/addyosmani">Addy Osmani</a></li>
+ <li><a href="https://github.com/sindresorhus/">Sindre Sorhus</a></li>
<li>Jarrod Overson</li>
</ul>
</section> <!-- #content -->
View
2  package.json
@@ -4,7 +4,7 @@
"homepage" : "http://hay.github.com/stapes",
"description": "A (really) tiny Javascript MVC microframework.",
"keywords": ["mvc", "framework", "lightweight"],
- "version": "0.4.0",
+ "version": "0.5.0",
"repository" : {
"type" : "git",
"url" : "http://github.com/hay/stapes.git"
View
2  stapes.js
@@ -17,7 +17,7 @@
(function() {
'use strict';
- var VERSION = "0.5-pre";
+ var VERSION = "0.5";
// Global counter for all events in all modules (including mixed in objects)
var guid = 1;
View
4 stapes.min.js
@@ -1,2 +1,2 @@
-// Stapes.js v0.4 - (c) Hay Kranen, released under the MIT license - http://hay.github.com/stapes
-(function(){function i(a,c){var d=this.get(a),e=c(b.clone(d));h.call(this,a,e)}function h(a,b){var c=this.has(a),d=e(this._guid)[a];if(b!==d){e(this._guid)[a]=b,this.emit("change",a),this.emit("change:"+a,b);var f={key:a,newValue:b,oldValue:d||null};this.emit("mutate",f),this.emit("mutate:"+a,f);var g=c?"update":"create";this.emit(g,a),this.emit(g+":"+a,b)}}function g(a,c,d,e){d=d||!1,e=e||this._guid,b.each(l._eventHandlers[e][a],function(a){var b=a.scope?a.scope:this;d&&(a.type=d),a.scope=b,a.handler.call(a.scope,c,a)},this)}function f(a){var c=b.create(a);c._guid=j++,l._attributes[c._guid]={},l._eventHandlers[c._guid]={};return c}function e(a){return l._attributes[a]}function d(a,d,e){var f={},g;typeof a=="string"?(g=e||!1,f[a]=d):(g=d||!1,f=a),b.each(f,function(a,d){var e=d.split(" ");b.each(e,function(b){c.call(this,{guid:this._guid,handler:a,scope:g,type:b})},this)},this)}function c(a){l._eventHandlers[a.guid][a.type]||(l._eventHandlers[a.guid][a.type]=[]),l._eventHandlers[a.guid][a.type].push({guid:a.guid,handler:a.handler,scope:a.scope,type:a.type})}"use strict";var a="0.4",b={bind:function(a,b){return Function.prototype.bind?a.bind(b):function(){return a.apply(b,arguments)}},clone:function(a){if(b.isArray(a))return a.slice();if(b.isObject(a)){var c={};b.each(a,function(a,b){c[b]=a});return c}return a},create:function(a){var b;if(typeof Object.create=="function")b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b},each:function(a,c,d){if(b.isArray(a))if(Array.prototype.forEach)a.forEach(c,d);else for(var e=0,f=a.length;e<f;e++)c.call(d,a[e],e);else for(var g in a)c.call(d,a[g],g)},filter:function(a,c,d){var e=[];if(b.isArray(a)&&Array.prototype.filter)return a.filter(c,d);b.each(a,function(a){c.call(d,a)&&e.push(a)});return e},isArray:function(a){return b.typeOf(a)==="array"},isObject:function(a){return b.typeOf(a)==="object"},keys:function(a){return b.map(a,function(a,b){return b})},makeUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},map:function(a,c,d){var e=[];if(b.isArray(a)&&Array.prototype.map)return a.map(c,d);b.each(a,function(a,b){e.push(c.call(d,a,b))});return e},size:function(a){return b.isArray(a)?a.length:b.keys(a).length},toArray:function(a){return b.isObject(a)?b.values(a):Array.prototype.slice.call(a,0)},typeOf:function(a){return Object.prototype.toString.call(a).replace(/\[object |\]/g,"").toLowerCase()},values:function(a){return b.map(a,function(a,b){return a})}},j=1,k={create:function(){return f(this)},each:function(a,c){b.each(e(this._guid),a,c||this)},emit:function(a,c){c=typeof c=="undefined"?null:c,b.each(a.split(" "),function(a){l._eventHandlers[-1].all&&g.call(this,"all",c,a,-1),l._eventHandlers[-1][a]&&g.call(this,a,c,a,-1),typeof this._guid=="number"&&(l._eventHandlers[this._guid].all&&g.call(this,"all",c,a),l._eventHandlers[this._guid][a]&&g.call(this,a,c))},this)},extend:function(a,c){var d=c?a:this,e=c?c:a;b.each(e,function(a,b){d[b]=a});return this},filter:function(a){return b.filter(e(this._guid),a)},get:function(a){if(typeof a=="string")return this.has(a)?e(this._guid)[a]:null;if(typeof a=="function"){var b=this.filter(a);return b.length?b[0]:null}},getAll:function(){return b.clone(e(this._guid))},getAllAsArray:function(){var a=b.map(e(this._guid),function(a,c){b.isObject(a)&&(a.id=c);return a});return b.clone(a)},has:function(a){return typeof e(this._guid)[a]!="undefined"},on:function(){d.apply(this,arguments)},push:function(a){b.isArray(a)?b.each(a,function(a){h.call(this,b.makeUuid(),a)},this):h.call(this,b.makeUuid(),a)},remove:function(a){typeof a=="function"?this.each(function(b,c){a(b)&&(delete e(this._guid)[c],this.emit("remove change"))}):this.has(a)&&(delete e(this._guid)[a],this.emit("remove change"))},set:function(a,c){b.isObject(a)?b.each(a,function(a,b){h.call(this,b,a)},this):h.call(this,a,c)},size:function(){return b.size(l._attributes[this._guid])},update:function(a,b){typeof a=="string"?i.call(this,a,b):typeof a=="function"&&this.each(function(b,c){i.call(this,c,a)})}},l={_attributes:{},_eventHandlers:{"-1":{}},_guid:-1,create:function(){return f(k)},extend:function(a){b.each(a,function(a,b){k[b]=a})},on:function(){d.apply(this,arguments)},util:b,version:a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=l),exports.Stapes=l):typeof define=="function"&&define.amd?define(function(){return l}):window.Stapes=l})()
+// Stapes.js v0.5 - (c) Hay Kranen, released under the MIT license - http://hay.github.com/stapes
+(function(){function l(a,b){var d=this.get(a),e=b(c.clone(d));k.call(this,a,e)}function k(a,b){var c=this.has(a),d=g(this._guid)[a];if(b!==d){g(this._guid)[a]=b,this.emit("change",a),this.emit("change:"+a,b);var e={key:a,newValue:b,oldValue:d||null};this.emit("mutate",e),this.emit("mutate:"+a,e);var f=c?"update":"create";this.emit(f,a),this.emit(f+":"+a,b)}}function j(a,b){var d=o._eventHandlers[this._guid];a&&b?c.each(d[a],function(c,e){c.handler===b&&d[a].splice(e--,1)},this):a?delete d[a]:o._eventHandlers[this._guid]={}}function i(a,b,d,e){d=d||!1,e=e||this._guid,c.each(o._eventHandlers[e][a],function(a){var c=a.scope?a.scope:this;d&&(a.type=d),a.scope=c,a.handler.call(a.scope,b,a)},this)}function h(a){var b=c.create(a);f(b),o.mixinEvents(b);return b}function g(a){return o._attributes[a]}function f(a){a._guid||(a._guid=b++,o._attributes[a._guid]={},o._eventHandlers[a._guid]={})}function e(a,b,e){var f={},g;typeof a=="string"?(g=e||!1,f[a]=b):(g=b||!1,f=a),c.each(f,function(a,b){var e=b.split(" ");c.each(e,function(b){d.call(this,{guid:this._guid,handler:a,scope:g,type:b})},this)},this)}function d(a){o._eventHandlers[a.guid][a.type]||(o._eventHandlers[a.guid][a.type]=[]),o._eventHandlers[a.guid][a.type].push({guid:a.guid,handler:a.handler,scope:a.scope,type:a.type})}"use strict";var a="0.5",b=1,c={bind:function(a,b){if(c.isObject(a)){c.each(a,function(b,d){c.typeOf(b)==="function"&&(a[d]=c.bind(b,a))});return a}return Function.prototype.bind?a.bind(b):function(){return a.apply(b,arguments)}},clone:function(a){if(c.isArray(a))return a.slice();if(c.isObject(a)){var b={};c.each(a,function(a,c){b[c]=a});return b}return a},create:function(a){var b;if(typeof Object.create=="function")b=Object.create(a);else{var c=function(){};c.prototype=a,b=new c}return b},each:function(a,b,d){if(c.isArray(a))if(Array.prototype.forEach)a.forEach(b,d);else for(var e=0,f=a.length;e<f;e++)b.call(d,a[e],e);else for(var g in a)b.call(d,a[g],g)},filter:function(a,b,d){var e=[];if(c.isArray(a)&&Array.prototype.filter)return a.filter(b,d);c.each(a,function(a){b.call(d,a)&&e.push(a)});return e},isArray:function(a){return c.typeOf(a)==="array"},isObject:function(a){return c.typeOf(a)==="object"},keys:function(a){return c.map(a,function(a,b){return b})},makeUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},map:function(a,b,d){var e=[];if(c.isArray(a)&&Array.prototype.map)return a.map(b,d);c.each(a,function(a,c){e.push(b.call(d,a,c))});return e},size:function(a){return c.isArray(a)?a.length:c.keys(a).length},toArray:function(a){return c.isObject(a)?c.values(a):Array.prototype.slice.call(a,0)},typeOf:function(a){return Object.prototype.toString.call(a).replace(/\[object |\]/g,"").toLowerCase()},values:function(a){return c.map(a,function(a,b){return a})}},m={emit:function(a,b){b=typeof b=="undefined"?null:b,c.each(a.split(" "),function(a){o._eventHandlers[-1].all&&i.call(this,"all",b,a,-1),o._eventHandlers[-1][a]&&i.call(this,a,b,a,-1),typeof this._guid=="number"&&(o._eventHandlers[this._guid].all&&i.call(this,"all",b,a),o._eventHandlers[this._guid][a]&&i.call(this,a,b))},this)},off:function(){j.apply(this,arguments)},on:function(){e.apply(this,arguments)}},n={create:function(){return h(this)},each:function(a,b){c.each(g(this._guid),a,b||this)},extend:function(a,b){var d=b?a:this,e=b?b:a;c.each(e,function(a,b){d[b]=a});return this},filter:function(a){return c.filter(g(this._guid),a)},get:function(a){if(typeof a=="string")return this.has(a)?g(this._guid)[a]:null;if(typeof a=="function"){var b=this.filter(a);return b.length?b[0]:null}},getAll:function(){return c.clone(g(this._guid))},getAllAsArray:function(){var a=c.map(g(this._guid),function(a,b){c.isObject(a)&&(a.id=b);return a});return c.clone(a)},has:function(a){return typeof g(this._guid)[a]!="undefined"},push:function(a){c.isArray(a)?c.each(a,function(a){k.call(this,c.makeUuid(),a)},this):k.call(this,c.makeUuid(),a)},remove:function(a){typeof a=="function"?this.each(function(b,c){a(b)&&(delete g(this._guid)[c],this.emit("remove change"))}):this.has(a)&&(delete g(this._guid)[a],this.emit("remove change"))},set:function(a,b){c.isObject(a)?c.each(a,function(a,b){k.call(this,b,a)},this):k.call(this,a,b)},size:function(){return c.size(o._attributes[this._guid])},update:function(a,b){typeof a=="string"?l.call(this,a,b):typeof a=="function"&&this.each(function(b,c){l.call(this,c,a)})}},o={_attributes:{},_eventHandlers:{"-1":{}},_guid:-1,create:function(){return h(n)},extend:function(a){c.each(a,function(a,b){n[b]=a})},mixinEvents:function(a){a=a||{},f(a),c.each(m,function(b,c){a[c]=b});return a},on:function(){e.apply(this,arguments)},util:c,version:a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=o),exports.Stapes=o):typeof define=="function"&&define.amd?define(function(){return o}):window.Stapes=o})()
Please sign in to comment.
Something went wrong with that request. Please try again.