Comments (6)
What I'd like to do is provide an interface to simply listen in on the following events,
- start
- stop
- reload
- navigate
- transition
This project will not provide actual routing, simply an interface for listening on events providing:
- matching
- fragment identifiers
- variable extrapolation
- query string processing
Refer to event emitter.
from core-routing.
A rather large and important question, is how to structure the interface. Do we use an observable pattern similar to the Node.js event emitter? Or do we use a more standardized single-definition callback pattern? Both options yield a number of pros and cons, but it boils down to flexibility vs simplicity.
from core-routing.
Update (9/2/19):
- Removed events for reload and transition.
- Reload is not logical with client sided routing.
- A transition should be handled respectfully by the consumer.
- I've gone with a single definition callback pattern. The syntax looks like:
-
const router = new Router({ client: { // onStart, onStop, onNavigate: (event) => ... } })
-
- I've greatly simplified the functional aspect of this project, as it's just an interface to subscribe to for routing. I've decided to put off fragment identification for release
0.0.2
. - I'm experimenting with memoizing for route processing. Given the router is client sided, this won't increase initial performance drastically, but will help thwart cumbersome computations (router tools
split
method will be called multiple times w/ the same arguments on occassion). Q: Should/can we use local storage?
from core-routing.
Update (9/6/19):
- I've implemented fragment identification to an extent, the router tools will process the given route and provide the name of the fragment. Anything beyond that functionality is for the consumer to implement.
- The initial implementation for the router tools has been completed. I've leveraged typescript-memoize to improve performance with redundant calls. I've also finished implementing support for query strings/arguments.
from core-routing.
Update (9/11/19):
- Fixed issue with memoize causing matching logic to fail.
- Completed legacy browsing support.
- Completed functional prototype of client interface.
- Completed basic core tests.
- Set up basic CI using GitHub Actions.
Todo:
- Documentation
from core-routing.
Closing this issue as version 0.0.1
has been published.
from core-routing.
Related Issues (20)
- left here, process route details using source
- ensure stop works as expected when binding watcher
- complete functional protoype -->
- resolve matching logic
- add test for config HOT 1
- add test for legacy support HOT 1
- 0.0.2 - Roadmap HOT 3
- Bug: Matching not working for path "/" HOT 2
- add documentation HOT 1
- Feature Request: Event emitter in observer pattern form for flexible use. HOT 2
- Complete basic README markup. HOT 1
- 0.0.3 - Roadmap HOT 2
- complete router tools and implement in router
- Add npm ignore to ignore none bundle modules and reduce package size.
- figure out why watch not called with history.pushState
- Fragment Identification HOT 1
- make ambiguous, must be able to run only on route change w/ interval
- leverage typescript decorator for memoize HOT 1
- implement optional localStorage cache w/ config
- revise when implementing fragment identification
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 core-routing.