Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New registry #39

Merged
merged 26 commits into from
Dec 23, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8a7c569
registry rewrite, closes #19, closes #34
rvagg Nov 25, 2011
04df8dc
move customEvents back down
rvagg Nov 25, 2011
b76786f
Merge branch 'master' into newregistry
rvagg Nov 25, 2011
16f8244
Merge branch 'master' into newregistry
rvagg Nov 25, 2011
e3ebc4b
broken merge
rvagg Nov 25, 2011
8caf6cd
cleanup and speedup
rvagg Nov 28, 2011
b644594
partial roll-back of #27
rvagg Nov 28, 2011
9318e5c
added benchmarks.html to test changes
rvagg Nov 28, 2011
591f4df
Merge remote-tracking branch 'fat/master' into newregistry
rvagg Dec 2, 2011
195dd32
registry.has() optimisations
rvagg Dec 3, 2011
4027c46
multi-library benchmarks based on @fat's benchmark.js work
rvagg Dec 3, 2011
f8b0312
\t
rvagg Dec 3, 2011
de39ff9
more benchmark work + nano-timer applet
rvagg Dec 4, 2011
befa148
closes #44
rvagg Dec 4, 2011
b2e1168
Merge remote-tracking branch 'fat/master' into newregistry
rvagg Dec 5, 2011
65b7618
added 3 sequence benchmarks, add/fire/remove
rvagg Dec 5, 2011
1976bcb
a few more comments
rvagg Dec 5, 2011
98a33c4
Skipping non-standard layerX and layerY. Reference to the original ev…
Dec 15, 2011
2cb0e08
Instead of targeting screex(x/y) properties in the if statement, norm…
Dec 16, 2011
d6d0f97
style change, no-semicolon, comma-first
rvagg Dec 20, 2011
bc1a4c9
Merge remote-tracking branch 'paulredmond/layerX-layerY' into newregi…
rvagg Dec 20, 2011
495c252
remove() and other fixes + more tests + cleanup
rvagg Dec 23, 2011
9ca51be
readme fixes
rvagg Dec 23, 2011
792f3af
Merge remote-tracking branch 'fat/master' into newregistry
rvagg Dec 23, 2011
0d45565
stop() yay!
rvagg Dec 23, 2011
909e5c0
Merge remote-tracking branch 'fat/master' into newregistry
rvagg Dec 23, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
*.swp
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "support/qwery"]
path = support/qwery
url = git@github.com:ded/qwery.git
[submodule "support/nwevents"]
path = support/nwevents
url = https://github.com/dperini/nwevents.git
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ one()

remove()
------
<code>bean.remove()</code> is how you get rid of listeners once you no longer want them. It's also a good idea to call remove on elements before you remove elements from your dom (this gives bean a chance to clean up some things and prevents memory leaks)
<code>bean.remove()</code> is how you get rid of listeners once you no longer want them. It's also a good idea to call remove on elements before you remove elements from your dom (this gives Bean a chance to clean up some things and prevents memory leaks)

```javascript
// remove a single event handlers
Expand All @@ -108,11 +108,17 @@ bean.remove(element, 'click', handler);
// remove all click handlers
bean.remove(element, 'click');

// remove handler for all events
bean.remove(element, handler);

// remove multiple events
bean.remove(element, 'mousedown mouseup');

// remove all events
bean.remove(element);

// remove handlers for events using object literal
bean.remove(element, { click: clickHandler, keyup: keyupHandler })
```

clone()
Expand Down Expand Up @@ -142,7 +148,7 @@ bean.fire(element, 'mousedown mouseup');

custom events
-------------
Bean uses methods similar to [Dean Edward's event model](http://dean.edwards.name/weblog/2009/03/callbacks-vs-events/) to ensure custom events behave like real events, rather than just callbacks.
Bean uses methods similar to [Dean Edwards' event model](http://dean.edwards.name/weblog/2009/03/callbacks-vs-events/) to ensure custom events behave like real events, rather than just callbacks.

For all intents and purposes, you can just think of them as native events, which will bubble up, and everything else you would expect...

Expand All @@ -163,7 +169,7 @@ use them like regular events:

object support
--------------
Good news, everything you can do in bean with an element, you can also do with an object! This is particularly useful for working with classes or plugins.
Good news, everything you can do in Bean with an element, you can also do with an object! This is particularly useful for working with classes or plugins.

```javascript
var inst = new Klass();
Expand Down Expand Up @@ -193,6 +199,12 @@ bean.add(el, 'click', function (e) {
e.stopPropagation();
});

// a simple shortcut, since you usually want preventDefault() and stopPropagation() at the same time
// (works the same as the previous example)
bean.add(el, 'click', function (e) {
e.stop();
});

// DOMContentLoaded
bean.add(document, 'DOMContentLoaded', fn);

Expand Down Expand Up @@ -220,9 +232,9 @@ point your browser at <code>bean/tests/index.html</code>
Ender Integration API
---------------------

If you use bean with ender it's API is greatly extended through it's Bridge file. This extension aims to give bean the look and feel of jQuery, but at the tiny size of bean.
If you use Bean with Ender its API is greatly extended through its bridge file. This extension aims to give Bean the look and feel of jQuery, but at the tiny size of Bean.

Here's the run down of the method alias's added...
Here's the run down of the method alias' added...

**ADD EVENTS**

Expand Down
6 changes: 4 additions & 2 deletions bean.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition);
else this[name] = definition();
}('bean', function () {
var win = window,
var context = this,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was in the noConflict PR I put in, I needed noConflict() to work so I could test bean.js (old) against src/bean.js (new).

old = this.bean,
win = window,
__uid = 1,
registry = {},
collected = {},
Expand Down Expand Up @@ -346,4 +348,4 @@
};

return bean;
});
});
53 changes: 30 additions & 23 deletions make/build.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
require('smoosh').config({
"JAVASCRIPT": {
"DIST_DIR": "./",
"bean": [
"./src/copyright.js",
"./src/bean.js"
]
},
"JSHINT_OPTS": {
"boss": true,
"forin": false,
"curly": false,
"debug": false,
"devel": false,
"evil": false,
"regexp": false,
"undef": false,
"sub": true,
"white": false,
"indent": 2,
"whitespace": true,
"asi": true
}
}).run().build().analyze();
'JAVASCRIPT': {
'DIST_DIR': './'
, 'bean': [
'./src/copyright.js'
, './src/bean.js'
]
}
, 'JSHINT_OPTS': {
'boss': true
, 'forin': true
, 'curly': false
, 'debug': true
, 'devel': false
, 'evil': false
, 'regexp': false
, 'undef': true
, 'sub': true
, 'white': false
, 'indent': 2
, 'whitespace': true
, 'asi': true
, 'trailing': true
, 'latedef': true
, 'laxbreak': true
, 'browser': true
, 'eqeqeq': true
, 'bitwise': false
, 'loopfunc': false
}
}).run().build().analyze()
Loading