Comments (14)
Keys passed into replaceStateOnce will bee stored in replaceStateOnceKeys.
bee
from can-route-pushstate.
Used in can-route for building regular expressions to match routes.
It is?
from can-route-pushstate.
DISPATCHHANDLERS
Updates this._value to the current url. PushstateObservable inherits from SimpleObservable which is using the can-event-queue/value/value mixin.
Why is inheritance relevant here? Maybe you are trying to talk about can.dispatch
. That's not clear from the language.
Updating the value is really only part of this function. The other important bit is that it dispatches event handlers on the object.
This should also talk about why this function would be called ... (as a result of calling history.pushstate)
Btw, I think this was supposed to cache can.dispatch
symbol.
from can-route-pushstate.
var linksHost = node.host || window.location.host;
I would generally put this code closer to where it matters ...
if (window.location.host === linksHost) {
from can-route-pushstate.
Test if you can preventDefault
Why might .preventDefault()
not be there?
If you don't know ... write nothing ...
from can-route-pushstate.
domEvents.addDelegateListener(document.documentElement, "click", "a", this.anchorClickHandler);
maybe this should be using can-globals/document/document
to get the current document ...
Especially since unonbound
is doing this:
var document = getDocument(),
window = getGlobal();
from can-route-pushstate.
Initalizes this._value Sets up event listeners to capture click events on elements. Overwrites the history api methods .pushState and .replaceState.
Missing a period?
from can-route-pushstate.
Adds PushstateObservable to the top of the stack and returns the current url.
What stack?
What this is really doing is making reading PushstateObservable
s observable by can-observation
s
from can-route-pushstate.
calls either pushState or replaceState on the difference in properties between oldProps and newProps.
Make sure all sentences start with Capital
and end with a period.
from can-route-pushstate.
patch.key refers to the mutated property name on newProps.
This doesn't really describe what's going on here. What's basically happening is the old state and the new state are diffed to figure out which keys are changing. Depending if the keys are used in replaceStateKeys
or replaceStateOnceKeys
, replaceState
will be used.
from can-route-pushstate.
var pushstateObservableProto = {
is this needed?
from can-route-pushstate.
There's no other use of "can.dispatch"
in the library, I'm not sure why there would be a need to cache it.
I'm not sure I understand:
What this is really doing is making reading PushstateObservables observable by can-observations
The only reason I know of for testing e.preventDefault
is browser compatibility, as it wasn't implemented in some older browsers.
The only use I could find for paramsMatcher
is in can-route
where it's either used to build regex or find substrings. added:
or return url substrings of routes.
from can-route-pushstate.
@HTMLGhozt It creates a slight performance benefit that probably isn't needed here, but helps in more heavily used code.
The following has to do 4 things:
obj[Symbol.for("thing")]
- Lookup
Symbol
- Lookup .for
- Call
.for
- Lookup the symbol on
obj
This has to do 2:
obj[thingSymbol]
- Lookup
thingSymbol
- Lookup the symbol on
obj
from can-route-pushstate.
#136 updates the documentation and refactors to fix the aforementioned issues.
from can-route-pushstate.
Related Issues (20)
- anchorClickHandler should preventDefault earlier HOT 2
- An in-range update of can-simple-observable is breaking the build 🚨 HOT 5
- An in-range update of can-define is breaking the build 🚨 HOT 18
- An in-range update of can-dom-events is breaking the build 🚨 HOT 3
- An in-range update of can-queues is breaking the build 🚨 HOT 4
- Documentation Updates
- The Pushstate constructor should work independent of can-route
- Documentation Improvements
- Removal of keepHash.
- When used with SSR
- Remove highlight.js workaround
- An in-range update of can-route is breaking the build 🚨 HOT 2
- An in-range update of can-reflect is breaking the build 🚨 HOT 2
- An in-range update of can-assign is breaking the build 🚨 HOT 2
- An in-range update of can-dom-events is breaking the build 🚨 HOT 2
- An in-range update of can-globals is breaking the build 🚨 HOT 1
- An in-range update of can-map is breaking the build 🚨 HOT 3
- An in-range update of can-queues is breaking the build 🚨 HOT 1
- route.data DefineMap - Include defaults HOT 1
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 can-route-pushstate.