Giter VIP home page Giter VIP logo

addressbar's Introduction

Cerebral

A declarative state and side effects management solution for popular JavaScript frameworks

NPM version Build status Coverage Status bitHound Score Commitizen friendly Discord

Maintainer needed

https://gist.github.com/christianalfoni/f1c4bfe320dcb24c403635d9bca3fa40

Documentation

Contribute

The entire Cerebral codebase has been rewritten to encourage contributions. The code is cleaned up, commented and all code is in a "monorepo". That means you can run tests across projects and general management of the code is simplified a lot.

  1. Clone the monorepo: git clone https://github.com/cerebral/cerebral.git
  2. In root: npm install

The packages are located under packages folder and there is no need to run npm install for each package.

Using monorepo for your own apps

If you want to use Cerebral 2 directly from your cloned repo, you can create a symlinks for following directories into the node_modules directory of your app:

  • packages/node_modules/cerebral
  • packages/node_modules/function-tree
  • packages/node_modules/@cerebral

If your app and the cerebral monorepo are in the same folder you can do from inside your app directory:

$ ln -s ../../cerebral/packages/node_modules/cerebral/ node_modules/
# ...

Just remember to unlink the package before installing it from npm:

$ unlink node_modules/cerebral
# ...

Running demos

Go to the respective packages/demos/some-demo-folder and run npm start

Testing

You can run all tests in all packages from root:

npm test

Or you can run tests for specific packages by going to package root and do the same:

npm test

Changing the code

When you make a code change you should create a branch first. When the code is changed and backed up by a test you can commit it from the root using:

npm run commit

This will give you a guide to creating a commit message. Then you just push and create a pull request as normal on Github.

Release process

  • Review and merge PRs into next branch. It is safe to use "Update branch", the commit created by Github will not be part of next history
  • If changes to repo-cooker, clean Travis NPM cache
  • From command line:
$ git checkout next
$ git pull
$ npm install # make sure any new dependencies are installed
$ npm install --no-save repo-cooker # needed to test release, make sure you have latest
$ npm run release # and check release notes
$ git checkout master
$ git pull
$ git merge --ff-only next
$ git push

addressbar's People

Contributors

christianalfoni avatar garth avatar guria avatar henri-hulski avatar jdeal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

addressbar's Issues

expose location properties

We need to completely free cerebral-router from depending on window.location because it should know nothing about it. All location related api must be provided by addressbar. It will simplify code and testing.

we can use https://github.com/cofounders/urlutils to expose properties like addressbar.origin, addressbar.pathname etc

Sanity checklist

package.json

  • naming
  • correct urls
  • deps
  • authors
  • contributors
  • license: MIT
  • scripts
  • keywords
  • private: y/n

README

  • badges at top, links at bottom
    • npm
    • build status
    • coverage
    • standard
    • commitizen

tests

  • folder: tests/
  • could be ran on travis
  • testing API, not tied to implementation

other files

  • LICENSE.md MIT
  • CONTRIBUTING.md
  • no generated content
  • .gitignore
  • .npmignore

workflow

  • coverage
  • standard
  • protect master
  • commitizen + cz-customizable
  • ghooks + validate-commit-msg
  • semantic-release
    • version 0.0.0
    • travis
    • cracks

Back and forward not working after link followed

I'm having an issue where the back and forward buttons are working fine unless I've followed one or more links, and then the updates the value in the browsers address bar but the change event doesn't fire.

I haven't dug into the problem yet, I might do tomorrow, but I thought I'd mention just in case you can replicate the behaviour.

document.referrer will not be updated by addressbar

Hi,

First of, i am using cerebral router for navigation.
It would be neat, to access the referrer (previous visited url) from the current visited url.
use-case1: i want to return to the previous site after clicking the save-button on a settings page.

  1. visit example.com/foo via addressbar
  2. enter settings via button click: goTo(example.com/settings)
  3. click on save-button at example.com/settings: save settings and redirect to referrer ( example.com/foo )

use-case2: i want to show a message after clicking the save-button on a settings page.

  1. visit example.com/settings via addressbar
  2. click on save-button at example.com/settings: save settings and show success/error message

While this is possible by saving the current location to state before going to example.com/settings, it would be easier if the new location just knows, where i came from.
Using window.history.back() is not sufficient, because i only want to go back to the previous location in use-case1
Using document.referrer would be sufficient, but it is not possible, because navigation with the router will not change the document.referrer. Is this a desired behaviour?

expose ability to replace state

variant 1

addressbar.replace(newUrl);

variant 2

addressbar.replaceNext();
addressbar.value = newUrl;

variant 3

addressbar.value = '!' + newUrl;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.