traceur-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/js/compile.js +7 -15
- data/lib/traceur.rb +2 -1
- data/lib/traceur/compilation_error.rb +27 -0
- data/lib/traceur/compiler.rb +4 -1
- data/lib/traceur/configuration.rb +1 -1
- data/lib/traceur/node/runner.rb +1 -1
- data/lib/traceur/version.rb +1 -1
- data/spec/examples/syntax_error.js +3 -0
- data/spec/integration/examples_spec.rb +6 -0
- data/vendor/node_modules/traceur/LICENSE +202 -0
- data/vendor/node_modules/traceur/README.md +5 -5
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
- data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
- data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
- data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
- data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
- data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
- data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
- data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
- data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
- data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
- data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
- data/vendor/node_modules/traceur/package.json +234 -20
- data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
- data/vendor/node_modules/traceur/src/node/System.js +32 -5
- data/vendor/node_modules/traceur/src/node/api.js +28 -93
- data/vendor/node_modules/traceur/src/node/command.js +84 -19
- data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
- data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
- data/vendor/node_modules/traceur/src/node/require.js +7 -21
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
- data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
- data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
- metadata +196 -190
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
- data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
- data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js
DELETED
@@ -1,247 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Based in part on observable arrays from Motorola Mobility’s Montage
|
3
|
-
Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved.
|
4
|
-
3-Clause BSD License
|
5
|
-
https://github.com/motorola-mobility/montage/blob/master/LICENSE.md
|
6
|
-
*/
|
7
|
-
|
8
|
-
/*
|
9
|
-
This module is responsible for observing changes to owned properties of
|
10
|
-
objects and changes to the content of arrays caused by method calls.
|
11
|
-
The interface for observing array content changes establishes the methods
|
12
|
-
necessary for any collection with observable content.
|
13
|
-
*/
|
14
|
-
|
15
|
-
require("../shim");
|
16
|
-
var List = require("../list");
|
17
|
-
var WeakMap = require("weak-map");
|
18
|
-
var PropertyChanges = require("./property-changes");
|
19
|
-
var RangeChanges = require("./range-changes");
|
20
|
-
var MapChanges = require("./map-changes");
|
21
|
-
|
22
|
-
var array_splice = Array.prototype.splice;
|
23
|
-
var array_slice = Array.prototype.slice;
|
24
|
-
var array_reverse = Array.prototype.reverse;
|
25
|
-
var array_sort = Array.prototype.sort;
|
26
|
-
|
27
|
-
// use different strategies for making arrays observable between Internet
|
28
|
-
// Explorer and other browsers.
|
29
|
-
var protoIsSupported = {}.__proto__ === Object.prototype;
|
30
|
-
var array_makeObservable;
|
31
|
-
if (protoIsSupported) {
|
32
|
-
array_makeObservable = function () {
|
33
|
-
this.__proto__ = ChangeDispatchArray;
|
34
|
-
};
|
35
|
-
} else {
|
36
|
-
array_makeObservable = function () {
|
37
|
-
Object.defineProperties(this, observableArrayProperties);
|
38
|
-
};
|
39
|
-
}
|
40
|
-
|
41
|
-
Object.defineProperty(Array.prototype, "makeObservable", {
|
42
|
-
value: array_makeObservable,
|
43
|
-
writable: true,
|
44
|
-
configurable: true,
|
45
|
-
enumerable: false
|
46
|
-
});
|
47
|
-
|
48
|
-
function defineEach(prototype) {
|
49
|
-
for (var name in prototype) {
|
50
|
-
Object.defineProperty(Array.prototype, name, {
|
51
|
-
value: prototype[name],
|
52
|
-
writable: true,
|
53
|
-
configurable: true,
|
54
|
-
enumerable: false
|
55
|
-
});
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
defineEach(PropertyChanges.prototype);
|
60
|
-
defineEach(RangeChanges.prototype);
|
61
|
-
defineEach(MapChanges.prototype);
|
62
|
-
|
63
|
-
var observableArrayProperties = {
|
64
|
-
|
65
|
-
isObservable: {
|
66
|
-
value: true,
|
67
|
-
writable: true,
|
68
|
-
configurable: true
|
69
|
-
},
|
70
|
-
|
71
|
-
makeObservable: {
|
72
|
-
value: Function.noop, // idempotent
|
73
|
-
writable: true,
|
74
|
-
configurable: true
|
75
|
-
},
|
76
|
-
|
77
|
-
reverse: {
|
78
|
-
value: function reverse() {
|
79
|
-
|
80
|
-
var reversed = this.constructClone(this);
|
81
|
-
reversed.reverse();
|
82
|
-
this.swap(0, this.length, reversed);
|
83
|
-
|
84
|
-
return this;
|
85
|
-
},
|
86
|
-
writable: true,
|
87
|
-
configurable: true
|
88
|
-
},
|
89
|
-
|
90
|
-
sort: {
|
91
|
-
value: function sort() {
|
92
|
-
|
93
|
-
// dispatch before change events
|
94
|
-
this.dispatchBeforeRangeChange(this, this, 0);
|
95
|
-
for (var i = 0; i < this.length; i++) {
|
96
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange(this, i, this[i]);
|
97
|
-
this.dispatchBeforeMapChange(i, this[i]);
|
98
|
-
}
|
99
|
-
|
100
|
-
// actual work
|
101
|
-
array_sort.apply(this, arguments);
|
102
|
-
|
103
|
-
// dispatch after change events
|
104
|
-
for (var i = 0; i < this.length; i++) {
|
105
|
-
PropertyChanges.dispatchOwnPropertyChange(this, i, this[i]);
|
106
|
-
this.dispatchMapChange(i, this[i]);
|
107
|
-
}
|
108
|
-
this.dispatchRangeChange(this, this, 0);
|
109
|
-
|
110
|
-
return this;
|
111
|
-
},
|
112
|
-
writable: true,
|
113
|
-
configurable: true
|
114
|
-
},
|
115
|
-
|
116
|
-
splice: {
|
117
|
-
value: function splice(start, length) {
|
118
|
-
var minus = array_slice.call(this, start, start + length);
|
119
|
-
var plus = array_slice.call(arguments, 2);
|
120
|
-
if (!minus.length && !plus.length)
|
121
|
-
return plus; // [], but spare us an instantiation
|
122
|
-
var diff = plus.length - minus.length;
|
123
|
-
var oldLength = this.length;
|
124
|
-
var newLength = Math.max(this.length + diff, start + plus.length);
|
125
|
-
var longest = Math.max(oldLength, newLength);
|
126
|
-
|
127
|
-
// dispatch before change events
|
128
|
-
if (diff) {
|
129
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange(this, "length", this.length);
|
130
|
-
}
|
131
|
-
this.dispatchBeforeRangeChange(plus, minus, start);
|
132
|
-
if (diff === 0) { // substring replacement
|
133
|
-
for (var i = start; i < start + plus.length; i++) {
|
134
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange(this, i, this[i]);
|
135
|
-
this.dispatchBeforeMapChange(i, this[i]);
|
136
|
-
}
|
137
|
-
} else if (PropertyChanges.hasOwnPropertyChangeDescriptor(this)) {
|
138
|
-
// all subsequent values changed or shifted.
|
139
|
-
// avoid (longest - start) long walks if there are no
|
140
|
-
// registered descriptors.
|
141
|
-
for (var i = start; i < longest; i++) {
|
142
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange(this, i, this[i]);
|
143
|
-
this.dispatchBeforeMapChange(i, this[i]);
|
144
|
-
}
|
145
|
-
}
|
146
|
-
|
147
|
-
// actual work
|
148
|
-
if (start > oldLength) {
|
149
|
-
this.length = start;
|
150
|
-
}
|
151
|
-
var result = array_splice.apply(this, arguments);
|
152
|
-
|
153
|
-
// dispatch after change events
|
154
|
-
if (diff === 0) { // substring replacement
|
155
|
-
for (var i = start; i < start + plus.length; i++) {
|
156
|
-
PropertyChanges.dispatchOwnPropertyChange(this, i, this[i]);
|
157
|
-
this.dispatchMapChange(i, this[i]);
|
158
|
-
}
|
159
|
-
} else if (PropertyChanges.hasOwnPropertyChangeDescriptor(this)) {
|
160
|
-
// all subsequent values changed or shifted.
|
161
|
-
// avoid (longest - start) long walks if there are no
|
162
|
-
// registered descriptors.
|
163
|
-
for (var i = start; i < longest; i++) {
|
164
|
-
PropertyChanges.dispatchOwnPropertyChange(this, i, this[i]);
|
165
|
-
this.dispatchMapChange(i, this[i]);
|
166
|
-
}
|
167
|
-
}
|
168
|
-
this.dispatchRangeChange(plus, minus, start);
|
169
|
-
if (diff) {
|
170
|
-
PropertyChanges.dispatchOwnPropertyChange(this, "length", this.length);
|
171
|
-
}
|
172
|
-
|
173
|
-
return result;
|
174
|
-
},
|
175
|
-
writable: true,
|
176
|
-
configurable: true
|
177
|
-
},
|
178
|
-
|
179
|
-
// splice is the array content change utility belt. forward all other
|
180
|
-
// content changes to splice so we only have to write observer code in one
|
181
|
-
// place
|
182
|
-
|
183
|
-
set: {
|
184
|
-
value: function set(index, value) {
|
185
|
-
this.splice(index, 1, value);
|
186
|
-
return this;
|
187
|
-
},
|
188
|
-
writable: true,
|
189
|
-
configurable: true
|
190
|
-
},
|
191
|
-
|
192
|
-
shift: {
|
193
|
-
value: function shift() {
|
194
|
-
return this.splice(0, 1)[0];
|
195
|
-
},
|
196
|
-
writable: true,
|
197
|
-
configurable: true
|
198
|
-
},
|
199
|
-
|
200
|
-
pop: {
|
201
|
-
value: function pop() {
|
202
|
-
if (this.length) {
|
203
|
-
return this.splice(this.length - 1, 1)[0];
|
204
|
-
}
|
205
|
-
},
|
206
|
-
writable: true,
|
207
|
-
configurable: true
|
208
|
-
},
|
209
|
-
|
210
|
-
push: {
|
211
|
-
value: function push(arg) {
|
212
|
-
if (arguments.length === 1) {
|
213
|
-
return this.splice(this.length, 0, arg);
|
214
|
-
} else {
|
215
|
-
var args = array_slice.call(arguments);
|
216
|
-
return this.swap(this.length, 0, args);
|
217
|
-
}
|
218
|
-
},
|
219
|
-
writable: true,
|
220
|
-
configurable: true
|
221
|
-
},
|
222
|
-
|
223
|
-
unshift: {
|
224
|
-
value: function unshift(arg) {
|
225
|
-
if (arguments.length === 1) {
|
226
|
-
return this.splice(0, 0, arg);
|
227
|
-
} else {
|
228
|
-
var args = array_slice.call(arguments);
|
229
|
-
return this.swap(0, 0, args);
|
230
|
-
}
|
231
|
-
},
|
232
|
-
writable: true,
|
233
|
-
configurable: true
|
234
|
-
},
|
235
|
-
|
236
|
-
clear: {
|
237
|
-
value: function clear() {
|
238
|
-
return this.splice(0, this.length);
|
239
|
-
},
|
240
|
-
writable: true,
|
241
|
-
configurable: true
|
242
|
-
}
|
243
|
-
|
244
|
-
};
|
245
|
-
|
246
|
-
var ChangeDispatchArray = Object.create(Array.prototype, observableArrayProperties);
|
247
|
-
|
data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var WeakMap = require("weak-map");
|
4
|
-
var List = require("../list");
|
5
|
-
|
6
|
-
module.exports = MapChanges;
|
7
|
-
function MapChanges() {
|
8
|
-
throw new Error("Can't construct. MapChanges is a mixin.");
|
9
|
-
}
|
10
|
-
|
11
|
-
var object_owns = Object.prototype.hasOwnProperty;
|
12
|
-
|
13
|
-
/*
|
14
|
-
Object map change descriptors carry information necessary for adding,
|
15
|
-
removing, dispatching, and shorting events to listeners for map changes
|
16
|
-
for a particular key on a particular object. These descriptors are used
|
17
|
-
here for shallow map changes.
|
18
|
-
|
19
|
-
{
|
20
|
-
willChangeListeners:Array(Function)
|
21
|
-
changeListeners:Array(Function)
|
22
|
-
}
|
23
|
-
*/
|
24
|
-
|
25
|
-
var mapChangeDescriptors = new WeakMap();
|
26
|
-
|
27
|
-
MapChanges.prototype.getAllMapChangeDescriptors = function () {
|
28
|
-
var Dict = require("../dict");
|
29
|
-
if (!mapChangeDescriptors.has(this)) {
|
30
|
-
mapChangeDescriptors.set(this, Dict());
|
31
|
-
}
|
32
|
-
return mapChangeDescriptors.get(this);
|
33
|
-
};
|
34
|
-
|
35
|
-
MapChanges.prototype.getMapChangeDescriptor = function (token) {
|
36
|
-
var tokenChangeDescriptors = this.getAllMapChangeDescriptors();
|
37
|
-
token = token || "";
|
38
|
-
if (!tokenChangeDescriptors.has(token)) {
|
39
|
-
tokenChangeDescriptors.set(token, {
|
40
|
-
willChangeListeners: new List(),
|
41
|
-
changeListeners: new List()
|
42
|
-
});
|
43
|
-
}
|
44
|
-
return tokenChangeDescriptors.get(token);
|
45
|
-
};
|
46
|
-
|
47
|
-
MapChanges.prototype.addMapChangeListener = function (listener, token, beforeChange) {
|
48
|
-
if (!this.isObservable && this.makeObservable) {
|
49
|
-
// for Array
|
50
|
-
this.makeObservable();
|
51
|
-
}
|
52
|
-
var descriptor = this.getMapChangeDescriptor(token);
|
53
|
-
var listeners;
|
54
|
-
if (beforeChange) {
|
55
|
-
listeners = descriptor.willChangeListeners;
|
56
|
-
} else {
|
57
|
-
listeners = descriptor.changeListeners;
|
58
|
-
}
|
59
|
-
listeners.push(listener);
|
60
|
-
Object.defineProperty(this, "dispatchesMapChanges", {
|
61
|
-
value: true,
|
62
|
-
writable: true,
|
63
|
-
configurable: true,
|
64
|
-
enumerable: false
|
65
|
-
});
|
66
|
-
|
67
|
-
var self = this;
|
68
|
-
return function cancelMapChangeListener() {
|
69
|
-
if (!self) {
|
70
|
-
// TODO throw new Error("Can't remove map change listener again");
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
self.removeMapChangeListener(listener, token, beforeChange);
|
74
|
-
self = null;
|
75
|
-
};
|
76
|
-
};
|
77
|
-
|
78
|
-
MapChanges.prototype.removeMapChangeListener = function (listener, token, beforeChange) {
|
79
|
-
var descriptor = this.getMapChangeDescriptor(token);
|
80
|
-
|
81
|
-
var listeners;
|
82
|
-
if (beforeChange) {
|
83
|
-
listeners = descriptor.willChangeListeners;
|
84
|
-
} else {
|
85
|
-
listeners = descriptor.changeListeners;
|
86
|
-
}
|
87
|
-
|
88
|
-
var node = listeners.findLast(listener);
|
89
|
-
if (!node) {
|
90
|
-
throw new Error("Can't remove listener: does not exist.");
|
91
|
-
}
|
92
|
-
node["delete"]();
|
93
|
-
};
|
94
|
-
|
95
|
-
MapChanges.prototype.dispatchMapChange = function (key, value, beforeChange) {
|
96
|
-
var descriptors = this.getAllMapChangeDescriptors();
|
97
|
-
var changeName = "Map" + (beforeChange ? "WillChange" : "Change");
|
98
|
-
descriptors.forEach(function (descriptor, token) {
|
99
|
-
|
100
|
-
if (descriptor.isActive) {
|
101
|
-
return;
|
102
|
-
} else {
|
103
|
-
descriptor.isActive = true;
|
104
|
-
}
|
105
|
-
|
106
|
-
var listeners;
|
107
|
-
if (beforeChange) {
|
108
|
-
listeners = descriptor.willChangeListeners;
|
109
|
-
} else {
|
110
|
-
listeners = descriptor.changeListeners;
|
111
|
-
}
|
112
|
-
|
113
|
-
var tokenName = "handle" + (
|
114
|
-
token.slice(0, 1).toUpperCase() +
|
115
|
-
token.slice(1)
|
116
|
-
) + changeName;
|
117
|
-
|
118
|
-
try {
|
119
|
-
// dispatch to each listener
|
120
|
-
listeners.forEach(function (listener) {
|
121
|
-
if (listener[tokenName]) {
|
122
|
-
listener[tokenName](value, key, this);
|
123
|
-
} else if (listener.call) {
|
124
|
-
listener.call(listener, value, key, this);
|
125
|
-
} else {
|
126
|
-
throw new Error("Handler " + listener + " has no method " + tokenName + " and is not callable");
|
127
|
-
}
|
128
|
-
}, this);
|
129
|
-
} finally {
|
130
|
-
descriptor.isActive = false;
|
131
|
-
}
|
132
|
-
|
133
|
-
}, this);
|
134
|
-
};
|
135
|
-
|
136
|
-
MapChanges.prototype.addBeforeMapChangeListener = function (listener, token) {
|
137
|
-
return this.addMapChangeListener(listener, token, true);
|
138
|
-
};
|
139
|
-
|
140
|
-
MapChanges.prototype.removeBeforeMapChangeListener = function (listener, token) {
|
141
|
-
return this.removeMapChangeListener(listener, token, true);
|
142
|
-
};
|
143
|
-
|
144
|
-
MapChanges.prototype.dispatchBeforeMapChange = function (key, value) {
|
145
|
-
return this.dispatchMapChange(key, value, true);
|
146
|
-
};
|
147
|
-
|
@@ -1,448 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Based in part on observable arrays from Motorola Mobility’s Montage
|
3
|
-
Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved.
|
4
|
-
3-Clause BSD License
|
5
|
-
https://github.com/motorola-mobility/montage/blob/master/LICENSE.md
|
6
|
-
*/
|
7
|
-
|
8
|
-
/*
|
9
|
-
This module is responsible for observing changes to owned properties of
|
10
|
-
objects and changes to the content of arrays caused by method calls.
|
11
|
-
The interface for observing array content changes establishes the methods
|
12
|
-
necessary for any collection with observable content.
|
13
|
-
*/
|
14
|
-
|
15
|
-
require("../shim");
|
16
|
-
var WeakMap = require("weak-map");
|
17
|
-
|
18
|
-
var object_owns = Object.prototype.hasOwnProperty;
|
19
|
-
|
20
|
-
/*
|
21
|
-
Object property descriptors carry information necessary for adding,
|
22
|
-
removing, dispatching, and shorting events to listeners for property changes
|
23
|
-
for a particular key on a particular object. These descriptors are used
|
24
|
-
here for shallow property changes.
|
25
|
-
|
26
|
-
{
|
27
|
-
willChangeListeners:Array(Function)
|
28
|
-
changeListeners:Array(Function)
|
29
|
-
}
|
30
|
-
*/
|
31
|
-
var propertyChangeDescriptors = new WeakMap();
|
32
|
-
|
33
|
-
// Maybe remove entries from this table if the corresponding object no longer
|
34
|
-
// has any property change listeners for any key. However, the cost of
|
35
|
-
// book-keeping is probably not warranted since it would be rare for an
|
36
|
-
// observed object to no longer be observed unless it was about to be disposed
|
37
|
-
// of or reused as an observable. The only benefit would be in avoiding bulk
|
38
|
-
// calls to dispatchOwnPropertyChange events on objects that have no listeners.
|
39
|
-
|
40
|
-
/*
|
41
|
-
To observe shallow property changes for a particular key of a particular
|
42
|
-
object, we install a property descriptor on the object that overrides the previous
|
43
|
-
descriptor. The overridden descriptors are stored in this weak map. The
|
44
|
-
weak map associates an object with another object that maps property names
|
45
|
-
to property descriptors.
|
46
|
-
|
47
|
-
overriddenObjectDescriptors.get(object)[key]
|
48
|
-
|
49
|
-
We retain the old descriptor for various purposes. For one, if the property
|
50
|
-
is no longer being observed by anyone, we revert the property descriptor to
|
51
|
-
the original. For "value" descriptors, we store the actual value of the
|
52
|
-
descriptor on the overridden descriptor, so when the property is reverted, it
|
53
|
-
retains the most recently set value. For "get" and "set" descriptors,
|
54
|
-
we observe then forward "get" and "set" operations to the original descriptor.
|
55
|
-
*/
|
56
|
-
var overriddenObjectDescriptors = new WeakMap();
|
57
|
-
|
58
|
-
module.exports = PropertyChanges;
|
59
|
-
|
60
|
-
function PropertyChanges() {
|
61
|
-
throw new Error("This is an abstract interface. Mix it. Don't construct it");
|
62
|
-
}
|
63
|
-
|
64
|
-
PropertyChanges.debug = true;
|
65
|
-
|
66
|
-
PropertyChanges.prototype.getOwnPropertyChangeDescriptor = function (key) {
|
67
|
-
if (!propertyChangeDescriptors.has(this)) {
|
68
|
-
propertyChangeDescriptors.set(this, {});
|
69
|
-
}
|
70
|
-
var objectPropertyChangeDescriptors = propertyChangeDescriptors.get(this);
|
71
|
-
if (!object_owns.call(objectPropertyChangeDescriptors, key)) {
|
72
|
-
objectPropertyChangeDescriptors[key] = {
|
73
|
-
willChangeListeners: [],
|
74
|
-
changeListeners: []
|
75
|
-
};
|
76
|
-
}
|
77
|
-
return objectPropertyChangeDescriptors[key];
|
78
|
-
};
|
79
|
-
|
80
|
-
PropertyChanges.prototype.hasOwnPropertyChangeDescriptor = function (key) {
|
81
|
-
if (!propertyChangeDescriptors.has(this)) {
|
82
|
-
return false;
|
83
|
-
}
|
84
|
-
if (!key) {
|
85
|
-
return true;
|
86
|
-
}
|
87
|
-
var objectPropertyChangeDescriptors = propertyChangeDescriptors.get(this);
|
88
|
-
if (!object_owns.call(objectPropertyChangeDescriptors, key)) {
|
89
|
-
return false;
|
90
|
-
}
|
91
|
-
return true;
|
92
|
-
};
|
93
|
-
|
94
|
-
PropertyChanges.prototype.addOwnPropertyChangeListener = function (key, listener, beforeChange) {
|
95
|
-
if (this.makeObservable && !this.isObservable) {
|
96
|
-
this.makeObservable(); // particularly for observable arrays, for
|
97
|
-
// their length property
|
98
|
-
}
|
99
|
-
var descriptor = PropertyChanges.getOwnPropertyChangeDescriptor(this, key);
|
100
|
-
var listeners;
|
101
|
-
if (beforeChange) {
|
102
|
-
listeners = descriptor.willChangeListeners;
|
103
|
-
} else {
|
104
|
-
listeners = descriptor.changeListeners;
|
105
|
-
}
|
106
|
-
PropertyChanges.makePropertyObservable(this, key);
|
107
|
-
listeners.push(listener);
|
108
|
-
|
109
|
-
var self = this;
|
110
|
-
return function cancelOwnPropertyChangeListener() {
|
111
|
-
PropertyChanges.removeOwnPropertyChangeListener(self, key, listeners, beforeChange);
|
112
|
-
self = null;
|
113
|
-
};
|
114
|
-
};
|
115
|
-
|
116
|
-
PropertyChanges.prototype.addBeforeOwnPropertyChangeListener = function (key, listener) {
|
117
|
-
return PropertyChanges.addOwnPropertyChangeListener(this, key, listener, true);
|
118
|
-
};
|
119
|
-
|
120
|
-
PropertyChanges.prototype.removeOwnPropertyChangeListener = function (key, listener, beforeChange) {
|
121
|
-
var descriptor = PropertyChanges.getOwnPropertyChangeDescriptor(this, key);
|
122
|
-
|
123
|
-
var listeners;
|
124
|
-
if (beforeChange) {
|
125
|
-
listeners = descriptor.willChangeListeners;
|
126
|
-
} else {
|
127
|
-
listeners = descriptor.changeListeners;
|
128
|
-
}
|
129
|
-
|
130
|
-
var index = listeners.lastIndexOf(listener);
|
131
|
-
if (index === -1) {
|
132
|
-
throw new Error("Can't remove listener: does not exist.");
|
133
|
-
}
|
134
|
-
listeners.splice(index, 1);
|
135
|
-
|
136
|
-
if (descriptor.changeListeners.length + descriptor.willChangeListeners.length === 0) {
|
137
|
-
PropertyChanges.makePropertyUnobservable(this, key);
|
138
|
-
}
|
139
|
-
};
|
140
|
-
|
141
|
-
PropertyChanges.prototype.removeBeforeOwnPropertyChangeListener = function (key, listener) {
|
142
|
-
return PropertyChanges.removeOwnPropertyChangeListener(this, key, listener, true);
|
143
|
-
};
|
144
|
-
|
145
|
-
PropertyChanges.prototype.dispatchOwnPropertyChange = function (key, value, beforeChange) {
|
146
|
-
var descriptor = PropertyChanges.getOwnPropertyChangeDescriptor(this, key);
|
147
|
-
|
148
|
-
if (descriptor.isActive) {
|
149
|
-
return;
|
150
|
-
}
|
151
|
-
descriptor.isActive = true;
|
152
|
-
|
153
|
-
var listeners;
|
154
|
-
if (beforeChange) {
|
155
|
-
listeners = descriptor.willChangeListeners;
|
156
|
-
} else {
|
157
|
-
listeners = descriptor.changeListeners;
|
158
|
-
}
|
159
|
-
|
160
|
-
var changeName = (beforeChange ? "Will" : "") + "Change";
|
161
|
-
var genericHandlerName = "handleProperty" + changeName;
|
162
|
-
var propertyName = String(key);
|
163
|
-
propertyName = propertyName && propertyName[0].toUpperCase() + propertyName.slice(1);
|
164
|
-
var specificHandlerName = "handle" + propertyName + changeName;
|
165
|
-
|
166
|
-
try {
|
167
|
-
// dispatch to each listener
|
168
|
-
listeners.forEach(function (listener) {
|
169
|
-
var thisp = listener;
|
170
|
-
listener = (
|
171
|
-
listener[specificHandlerName] ||
|
172
|
-
listener[genericHandlerName] ||
|
173
|
-
listener
|
174
|
-
);
|
175
|
-
if (!listener.call) {
|
176
|
-
throw new Error("No event listener for " + specificHandlerName + " or " + genericHandlerName + " or call on " + listener);
|
177
|
-
}
|
178
|
-
listener.call(thisp, value, key, this);
|
179
|
-
}, this);
|
180
|
-
} finally {
|
181
|
-
descriptor.isActive = false;
|
182
|
-
}
|
183
|
-
};
|
184
|
-
|
185
|
-
PropertyChanges.prototype.dispatchBeforeOwnPropertyChange = function (key, listener) {
|
186
|
-
return PropertyChanges.dispatchOwnPropertyChange(this, key, listener, true);
|
187
|
-
};
|
188
|
-
|
189
|
-
PropertyChanges.prototype.makePropertyObservable = function (key) {
|
190
|
-
// arrays are special. we do not support direct setting of properties
|
191
|
-
// on an array. instead, call .set(index, value). this is observable.
|
192
|
-
// 'length' property is observable for all mutating methods because
|
193
|
-
// our overrides explicitly dispatch that change.
|
194
|
-
if (Array.isArray(this)) {
|
195
|
-
return;
|
196
|
-
}
|
197
|
-
|
198
|
-
if (!Object.isExtensible(this, key)) {
|
199
|
-
throw new Error("Can't make property " + JSON.stringify(key) + " observable on " + this + " because object is not extensible");
|
200
|
-
}
|
201
|
-
|
202
|
-
var state;
|
203
|
-
if (typeof this.__state__ === "object") {
|
204
|
-
state = this.__state__;
|
205
|
-
} else {
|
206
|
-
state = {};
|
207
|
-
if (Object.isExtensible(this, "__state__")) {
|
208
|
-
Object.defineProperty(this, "__state__", {
|
209
|
-
value: state,
|
210
|
-
writable: true,
|
211
|
-
enumerable: false
|
212
|
-
});
|
213
|
-
}
|
214
|
-
}
|
215
|
-
state[key] = this[key];
|
216
|
-
|
217
|
-
// memoize overridden property descriptor table
|
218
|
-
if (!overriddenObjectDescriptors.has(this)) {
|
219
|
-
overriddenPropertyDescriptors = {};
|
220
|
-
overriddenObjectDescriptors.set(this, overriddenPropertyDescriptors);
|
221
|
-
}
|
222
|
-
var overriddenPropertyDescriptors = overriddenObjectDescriptors.get(this);
|
223
|
-
|
224
|
-
if (object_owns.call(overriddenPropertyDescriptors, key)) {
|
225
|
-
// if we have already recorded an overridden property descriptor,
|
226
|
-
// we have already installed the observer, so short-here
|
227
|
-
return;
|
228
|
-
}
|
229
|
-
|
230
|
-
// walk up the prototype chain to find a property descriptor for
|
231
|
-
// the property name
|
232
|
-
var overriddenDescriptor;
|
233
|
-
var attached = this;
|
234
|
-
var formerDescriptor = Object.getOwnPropertyDescriptor(attached, key);
|
235
|
-
do {
|
236
|
-
overriddenDescriptor = Object.getOwnPropertyDescriptor(attached, key);
|
237
|
-
if (overriddenDescriptor) {
|
238
|
-
break;
|
239
|
-
}
|
240
|
-
attached = Object.getPrototypeOf(attached);
|
241
|
-
} while (attached);
|
242
|
-
// or default to an undefined value
|
243
|
-
overriddenDescriptor = overriddenDescriptor || {
|
244
|
-
value: undefined,
|
245
|
-
enumerable: true,
|
246
|
-
writable: true,
|
247
|
-
configurable: true
|
248
|
-
};
|
249
|
-
|
250
|
-
if (!overriddenDescriptor.configurable) {
|
251
|
-
throw new Error("Can't observe non-configurable properties");
|
252
|
-
}
|
253
|
-
|
254
|
-
// memoize the descriptor so we know not to install another layer,
|
255
|
-
// and so we can reuse the overridden descriptor when uninstalling
|
256
|
-
overriddenPropertyDescriptors[key] = overriddenDescriptor;
|
257
|
-
|
258
|
-
// give up *after* storing the overridden property descriptor so it
|
259
|
-
// can be restored by uninstall. Unwritable properties are
|
260
|
-
// silently not overriden. Since success is indistinguishable from
|
261
|
-
// failure, we let it pass but don't waste time on intercepting
|
262
|
-
// get/set.
|
263
|
-
if (!overriddenDescriptor.writable && !overriddenDescriptor.set) {
|
264
|
-
return;
|
265
|
-
}
|
266
|
-
|
267
|
-
// TODO reflect current value on a displayed property
|
268
|
-
|
269
|
-
var propertyListener;
|
270
|
-
// in both of these new descriptor variants, we reuse the overridden
|
271
|
-
// descriptor to either store the current value or apply getters
|
272
|
-
// and setters. this is handy since we can reuse the overridden
|
273
|
-
// descriptor if we uninstall the observer. We even preserve the
|
274
|
-
// assignment semantics, where we get the value from up the
|
275
|
-
// prototype chain, and set as an owned property.
|
276
|
-
if ('value' in overriddenDescriptor) {
|
277
|
-
propertyListener = {
|
278
|
-
get: function () {
|
279
|
-
return overriddenDescriptor.value
|
280
|
-
},
|
281
|
-
set: function (value) {
|
282
|
-
if (value === overriddenDescriptor.value) {
|
283
|
-
return value;
|
284
|
-
}
|
285
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange(this, key, overriddenDescriptor.value);
|
286
|
-
overriddenDescriptor.value = value;
|
287
|
-
state[key] = value;
|
288
|
-
PropertyChanges.dispatchOwnPropertyChange(this, key, value);
|
289
|
-
return value;
|
290
|
-
},
|
291
|
-
enumerable: overriddenDescriptor.enumerable,
|
292
|
-
configurable: true
|
293
|
-
};
|
294
|
-
} else { // 'get' or 'set', but not necessarily both
|
295
|
-
propertyListener = {
|
296
|
-
get: function () {
|
297
|
-
if (overriddenDescriptor.get) {
|
298
|
-
return overriddenDescriptor.get.apply(this, arguments);
|
299
|
-
}
|
300
|
-
},
|
301
|
-
set: function (value) {
|
302
|
-
var formerValue;
|
303
|
-
|
304
|
-
// get the actual former value if possible
|
305
|
-
if (overriddenDescriptor.get) {
|
306
|
-
formerValue = overriddenDescriptor.get.apply(this, arguments);
|
307
|
-
}
|
308
|
-
// call through to actual setter
|
309
|
-
if (overriddenDescriptor.set) {
|
310
|
-
overriddenDescriptor.set.apply(this, arguments)
|
311
|
-
}
|
312
|
-
// use getter, if possible, to discover whether the set
|
313
|
-
// was successful
|
314
|
-
if (overriddenDescriptor.get) {
|
315
|
-
value = overriddenDescriptor.get.apply(this, arguments);
|
316
|
-
state[key] = value;
|
317
|
-
}
|
318
|
-
// if it has not changed, suppress a notification
|
319
|
-
if (value === formerValue) {
|
320
|
-
return value;
|
321
|
-
}
|
322
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange(this, key, formerValue);
|
323
|
-
|
324
|
-
// dispatch the new value: the given value if there is
|
325
|
-
// no getter, or the actual value if there is one
|
326
|
-
PropertyChanges.dispatchOwnPropertyChange(this, key, value);
|
327
|
-
return value;
|
328
|
-
},
|
329
|
-
enumerable: overriddenDescriptor.enumerable,
|
330
|
-
configurable: true
|
331
|
-
};
|
332
|
-
}
|
333
|
-
|
334
|
-
Object.defineProperty(this, key, propertyListener);
|
335
|
-
};
|
336
|
-
|
337
|
-
PropertyChanges.prototype.makePropertyUnobservable = function (key) {
|
338
|
-
// arrays are special. we do not support direct setting of properties
|
339
|
-
// on an array. instead, call .set(index, value). this is observable.
|
340
|
-
// 'length' property is observable for all mutating methods because
|
341
|
-
// our overrides explicitly dispatch that change.
|
342
|
-
if (Array.isArray(this)) {
|
343
|
-
return;
|
344
|
-
}
|
345
|
-
|
346
|
-
if (!overriddenObjectDescriptors.has(this)) {
|
347
|
-
throw new Error("Can't uninstall observer on property");
|
348
|
-
}
|
349
|
-
var overriddenPropertyDescriptors = overriddenObjectDescriptors.get(this);
|
350
|
-
|
351
|
-
if (!overriddenPropertyDescriptors[key]) {
|
352
|
-
throw new Error("Can't uninstall observer on property");
|
353
|
-
}
|
354
|
-
|
355
|
-
var overriddenDescriptor = overriddenPropertyDescriptors[key];
|
356
|
-
delete overriddenPropertyDescriptors[key];
|
357
|
-
|
358
|
-
var state;
|
359
|
-
if (typeof this.__state__ === "object") {
|
360
|
-
state = this.__state__;
|
361
|
-
} else {
|
362
|
-
state = {};
|
363
|
-
if (Object.isExtensible(this, "__state__")) {
|
364
|
-
Object.defineProperty(this, "__state__", {
|
365
|
-
value: state,
|
366
|
-
writable: true,
|
367
|
-
enumerable: false
|
368
|
-
});
|
369
|
-
}
|
370
|
-
}
|
371
|
-
delete state[key];
|
372
|
-
|
373
|
-
Object.defineProperty(this, key, overriddenDescriptor);
|
374
|
-
};
|
375
|
-
|
376
|
-
// constructor functions
|
377
|
-
|
378
|
-
PropertyChanges.getOwnPropertyChangeDescriptor = function (object, key) {
|
379
|
-
if (object.getOwnPropertyChangeDescriptor) {
|
380
|
-
return object.getOwnPropertyChangeDescriptor(key);
|
381
|
-
} else {
|
382
|
-
return PropertyChanges.prototype.getOwnPropertyChangeDescriptor.call(object, key);
|
383
|
-
}
|
384
|
-
};
|
385
|
-
|
386
|
-
PropertyChanges.hasOwnPropertyChangeDescriptor = function (object, key) {
|
387
|
-
if (object.hasOwnPropertyChangeDescriptor) {
|
388
|
-
return object.hasOwnPropertyChangeDescriptor(key);
|
389
|
-
} else {
|
390
|
-
return PropertyChanges.prototype.hasOwnPropertyChangeDescriptor.call(object, key);
|
391
|
-
}
|
392
|
-
};
|
393
|
-
|
394
|
-
PropertyChanges.addOwnPropertyChangeListener = function (object, key, listener, beforeChange) {
|
395
|
-
if (!Object.isObject(object)) {
|
396
|
-
} else if (object.addOwnPropertyChangeListener) {
|
397
|
-
return object.addOwnPropertyChangeListener(key, listener, beforeChange);
|
398
|
-
} else {
|
399
|
-
return PropertyChanges.prototype.addOwnPropertyChangeListener.call(object, key, listener, beforeChange);
|
400
|
-
}
|
401
|
-
};
|
402
|
-
|
403
|
-
PropertyChanges.removeOwnPropertyChangeListener = function (object, key, listener, beforeChange) {
|
404
|
-
if (!Object.isObject(object)) {
|
405
|
-
} else if (object.removeOwnPropertyChangeListener) {
|
406
|
-
return object.removeOwnPropertyChangeListener(key, listener, beforeChange);
|
407
|
-
} else {
|
408
|
-
return PropertyChanges.prototype.removeOwnPropertyChangeListener.call(object, key, listener, beforeChange);
|
409
|
-
}
|
410
|
-
};
|
411
|
-
|
412
|
-
PropertyChanges.dispatchOwnPropertyChange = function (object, key, value, beforeChange) {
|
413
|
-
if (!Object.isObject(object)) {
|
414
|
-
} else if (object.dispatchOwnPropertyChange) {
|
415
|
-
return object.dispatchOwnPropertyChange(key, value, beforeChange);
|
416
|
-
} else {
|
417
|
-
return PropertyChanges.prototype.dispatchOwnPropertyChange.call(object, key, value, beforeChange);
|
418
|
-
}
|
419
|
-
};
|
420
|
-
|
421
|
-
PropertyChanges.addBeforeOwnPropertyChangeListener = function (object, key, listener) {
|
422
|
-
return PropertyChanges.addOwnPropertyChangeListener(object, key, listener, true);
|
423
|
-
};
|
424
|
-
|
425
|
-
PropertyChanges.removeBeforeOwnPropertyChangeListener = function (object, key, listener) {
|
426
|
-
return PropertyChanges.removeOwnPropertyChangeListener(object, key, listener, true);
|
427
|
-
};
|
428
|
-
|
429
|
-
PropertyChanges.dispatchBeforeOwnPropertyChange = function (object, key, value) {
|
430
|
-
return PropertyChanges.dispatchOwnPropertyChange(object, key, value, true);
|
431
|
-
};
|
432
|
-
|
433
|
-
PropertyChanges.makePropertyObservable = function (object, key) {
|
434
|
-
if (object.makePropertyObservable) {
|
435
|
-
return object.makePropertyObservable(key);
|
436
|
-
} else {
|
437
|
-
return PropertyChanges.prototype.makePropertyObservable.call(object, key);
|
438
|
-
}
|
439
|
-
};
|
440
|
-
|
441
|
-
PropertyChanges.makePropertyUnobservable = function (object, key) {
|
442
|
-
if (object.makePropertyUnobservable) {
|
443
|
-
return object.makePropertyUnobservable(key);
|
444
|
-
} else {
|
445
|
-
return PropertyChanges.prototype.makePropertyUnobservable.call(object, key);
|
446
|
-
}
|
447
|
-
};
|
448
|
-
|