Skip to content

Commit

Permalink
enhancement in development:
Browse files Browse the repository at this point in the history
1. manage config files in one file
2. move scrollama.js from dev to build, just to keep it DRY
3. use uglify in rollup
4. add rollup-plugin-filesize so that we can notify the size of every building
5. use cross-env to avoid building crash in windows
  • Loading branch information
SidKwok committed Nov 23, 2017
1 parent ddeaadd commit 1072902
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1,208 deletions.
23 changes: 8 additions & 15 deletions build/scrollama.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,10 @@
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
*/

(function(window, document) {
Expand All @@ -31,7 +24,7 @@ if ('IntersectionObserver' in window &&
'intersectionRatio' in window.IntersectionObserverEntry.prototype) {

// Minimal polyfill for Edge 15's lack of `isIntersecting`
// See: https://github.com/WICG/IntersectionObserver/issues/211
// See: https://github.com/w3c/IntersectionObserver/issues/211
if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
Object.defineProperty(window.IntersectionObserverEntry.prototype,
'isIntersecting', {
Expand All @@ -55,7 +48,7 @@ var registry = [];

/**
* Creates the global IntersectionObserverEntry constructor.
* https://wicg.github.io/IntersectionObserver/#intersection-observer-entry
* https://w3c.github.io/IntersectionObserver/#intersection-observer-entry
* @param {Object} entry A dictionary of instance properties.
* @constructor
*/
Expand Down Expand Up @@ -85,7 +78,7 @@ function IntersectionObserverEntry(entry) {

/**
* Creates the global IntersectionObserver constructor.
* https://wicg.github.io/IntersectionObserver/#intersection-observer-interface
* https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
* @param {Function} callback The function to be invoked after intersection
* changes have queued. The function is not invoked if the queue has
* been emptied by calling the `takeRecords` method.
Expand Down Expand Up @@ -363,7 +356,7 @@ IntersectionObserver.prototype._checkForIntersections = function() {
* Accepts a target and root rect computes the intersection between then
* following the algorithm in the spec.
* TODO(philipwalton): at this time clip-path is not considered.
* https://wicg.github.io/IntersectionObserver/#calculate-intersection-rect-algo
* https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo
* @param {Element} target The target DOM element
* @param {Object} rootRect The bounding rect of the root after being
* expanded by the rootMargin value.
Expand Down Expand Up @@ -656,7 +649,7 @@ function getBoundingClientRect(el) {
rect = el.getBoundingClientRect();
} catch (err) {
// Ignore Windows 7 IE11 "Unspecified error"
// https://github.com/WICG/IntersectionObserver/pull/205
// https://github.com/w3c/IntersectionObserver/pull/205
}

if (!rect) { return getEmptyRect(); }
Expand Down
2 changes: 1 addition & 1 deletion build/scrollama.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</section>
<div class='debug'></div>
<script src='d3.v4.min.js'></script>
<script src='scrollama.js'></script>
<script src='../build/scrollama.js'></script>
<script>
var container = d3.select('#scroll')
var graphic = container.select('.scroll__graphic')
Expand Down Expand Up @@ -183,4 +183,4 @@
</script>
</body>

</html>
</html>
Loading

0 comments on commit 1072902

Please sign in to comment.