-
Notifications
You must be signed in to change notification settings - Fork 786
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
Modularize the codebase and use ES6 features with Babel+browserify+gulp build #231
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nd karma for testing (this commit is scaffolding only and does not aim to split interact into modules) - move interact.js source to a `src` folder and introduce a `build` folder - get existing tests to run (mostly) with browserified karma, configured for mocha, chai and using fixture for html fixtures - add dependencies for `gulp-starter` based build process - remove icon font tasks from gulp process, while the others may be useful for docs/demo's folders, we won't be needing icons
events extend arr - indexOf, contains domObjects - document, Element, etc. isType - isArray, isString, isWindow, etc.
extract `Interaction` and `InteractionEvent` to modules
…e/interact.js into task-runner-and-build-system
in favour of `!!` which is more performant http://jsperf.com/bool-vs-doublenot
A subjective change, but takes out the repetition of `module.exports.`, may make it easier to grok
Since `typeof` always returns a string (ie. `typeof someUndefinedVar` renders `"undefined"`) we'll need to check against `"undefined"` not `undefined`
replaced with references to `browser`, `isType` and `InteractEvent`
Again a subjective change, but by having exports statements in conditional blocks it makes it unclear what values are being exported by the module, making it necessary to read all the code to get a grasp of what is happening. Effectively, exporting inside conditionals is adding cyclomatic complexity to the module definition, its much clearer to the reader of the module if they can look in a single literal and see what they can expect to get from the module. Cleaned up the Shadow DOM check to make it more self explanatory
getTouchPair, touchAngle, touchAverage, touchBBox, touchDistance
Requires changes from the next commit.
Replace getInteractionFromPointer with utils/interactionFinder module: interaction = finder.search(pointer, eventType, eventTarget);
taye
force-pushed
the
modularization
branch
from
September 13, 2015 17:20
e93ab8c
to
0227d75
Compare
... to their respective modules
... instead of require('./utils')
inertiaStatus isn't given as an arg property. Get it from interaction.inertiaStatus
Without doing so dist/interact.js.map is not created correctly.
Interactable.{accept,dropzone} interact.margin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch splits the monolithic
./interact.js
file into separate modules to be bundled together with browserify. It also makes actions (drag, resize, gesture), modifiers (snap, restrict), pointerEvents (down
,tap
,hold
, etc.) and autoScroll optional and provides interfaces for adding new actions and modifiers.An internal
signals
API been introduced which allows modules to hook into various points in the codebase without tight coupling, eg.:Eslint is now used for style checking instead of JSHint and the formatting style of the project has been changed. Most notably:
let
andconst
instead ofvar
let
/const
per identifierOne-time setup:
npm install
to install interact.js' development dependenciesTo build interact.js, run:
This will generate the following files in the
./dist
directory:Many thanks to @stephen-james for his help!
Closes #110