Comments (17)
The function to set the dom element of an already instantiated delegate object could be
function watch(root) {
// TODO: Add the code that is currently in the
// constructor, then in the constructor call this
// function if the argument is provided.
}
from ftdomdelegate.
How about attach
and detach
? The method watch
seems to imply that you can keep adding root elements on which to listen for events, but we don't support that.
from ftdomdelegate.
attach
also seems to imply that you can keep adding root elements too...
from ftdomdelegate.
You're right. How about pause
and play
, with play accepting a new root as the argument?
from ftdomdelegate.
If we could use bind
and unbind
(rebind
?) that would be perfect. (jQuery sets up functions with these names - maybe we can too? May get confusing with the native js function bind
though)
Pause and play imply you could temporarily stop the delegate (pause();
) and then restore it to use its original root element (play();
) which I don't think is needed...
(iPhone GitHub app so apologies for no grammar)
from ftdomdelegate.
Pause and play imply you could temporarily stop the delegate (pause();) and then restore it to use its original root element (play();)
I actually like this. bind
and unbind
are a bit vague - I think even people who use jQuery have to check the documentation every time. In our case it'd be worse because we'd also have on
and off
.
So we'd have pause
and play
, which leave the list of registered callbacks unaffected, and destroy
which resets everything.
from ftdomdelegate.
Changed my mind. unbind
would allow us to discard the reference to the root node, and that's what we want :)
from ftdomdelegate.
We could still implement destroy
which would be:-
delegate.prototype.destroy = function () {
this.unbind();
this.off();
}
from ftdomdelegate.
I agree with earlier comments. The 'bind'/'unbind' syntax is confusing. If I'm familiar with jQuery I would assume that this was the API (or an alias to the on/off methods) for attaching and removing events. I suggest delegate.root(el)
; and something like delegate.clearRoot();
or delegate.root('clear');
Feel free to ignore me :)
from ftdomdelegate.
I accept it is a little confusing but I think we can do better than root
and clearRoot
.
What do we have so far...
watch
& unwatch
attach
& detach
play
& pause
bind
& unbind
root
& clearRoot
Some more to throw into the mix:-
tie
& untie
link
& unlink
enslave
& liberate
/ free
connect
& disconnect
hold
& release
represent
& betray
apple
& cranberry
marry
& divorce
(https://twitter.com/TheTeethgrinder/status/293472511788711936)
from ftdomdelegate.
lol! Loving this. Such evocative words for assigning an element to an instance!
What about:
delegate.el(element) // assign
delegate.el() //unassign
from ftdomdelegate.
No hablo español.
setRoot(element)
& setRoot()
?
from ftdomdelegate.
Ok. Why not:
delegate.root(element);
delegate.root();
?
from ftdomdelegate.
unroot
?
from ftdomdelegate.
root
and uproot
!!!
from ftdomdelegate.
Too clever! Chill out ;)
I guess unroot
works. I'm just alway in favour of keeping the interface as small as possible (if possible). Especially with a lib as small as this.
from ftdomdelegate.
Sold. Let's go with root(element)
and root()
.
from ftdomdelegate.
Related Issues (20)
- Event namespaces: Interested in including them? HOT 7
- Behavior is non-standard when handler returns false HOT 4
- stopPropagation does not stop propagation to listeners added with ftdomdelegate
- Event listener execution order is backwards when useCapture = true HOT 1
- Browser compatible bower build HOT 6
- unexpected mouseover/mouseout behavior w/ capture
- multiple event binding HOT 3
- TypeError: 'undefined' is not a function (evaluating 'Delegate.prototype.handle.bind(this)') in Konacha HOT 5
- Waiting for window load event in README examples HOT 2
- Error on uglification HOT 2
- Click events are fired on disabled button with element like i tag. HOT 3
- useCapture not properly documented HOT 1
- Inconsistently named installs with bower HOT 6
- Custom events HOT 1
- Change requirements for IE8 support
- Why are there two names for this module? HOT 5
- IE10 click event doesn't work on an SVG. HOT 3
- Move to CircleCI and use occ to publish to npm on tag HOT 1
- ftdomdelegate complete breaking checklist HOT 1
- IE11 SCRIPT5007: Unable to get property 'call' of undefined or null reference
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ftdomdelegate.