discourse-ember-source 3.5.1.1 → 3.5.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (741) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ember/version.rb +1 -1
  3. metadata +2 -740
  4. data/.gitignore +0 -9
  5. data/.travis.yml +0 -5
  6. data/Gemfile +0 -6
  7. data/LICENSE.txt +0 -21
  8. data/README +0 -18
  9. data/README.md +0 -39
  10. data/Rakefile +0 -27
  11. data/bin/console +0 -14
  12. data/bin/setup +0 -8
  13. data/discourse-ember-source-3.5.1.0.gem +0 -0
  14. data/dist/ember-all.debug.map +0 -1
  15. data/dist/ember-template-compiler.map +0 -1
  16. data/dist/ember-testing.map +0 -1
  17. data/dist/ember-tests.map +0 -1
  18. data/dist/ember-tests.prod.map +0 -1
  19. data/dist/ember.debug.map +0 -1
  20. data/dist/ember.min.map +0 -1
  21. data/dist/ember.prod.map +0 -1
  22. data/dist/es/@ember/application/globals-resolver.js +0 -425
  23. data/dist/es/@ember/application/index.js +0 -3
  24. data/dist/es/@ember/application/instance.js +0 -513
  25. data/dist/es/@ember/application/lib/application.js +0 -1139
  26. data/dist/es/@ember/application/lib/lazy_load.js +0 -69
  27. data/dist/es/@ember/application/lib/validate-type.js +0 -24
  28. data/dist/es/@ember/application/tests/application_instance_test.js +0 -230
  29. data/dist/es/@ember/application/tests/application_test.js +0 -470
  30. data/dist/es/@ember/application/tests/bootstrap-test.js +0 -28
  31. data/dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js +0 -32
  32. data/dist/es/@ember/application/tests/dependency_injection/default_resolver_test.js +0 -363
  33. data/dist/es/@ember/application/tests/dependency_injection/normalization_test.js +0 -70
  34. data/dist/es/@ember/application/tests/dependency_injection/to_string_test.js +0 -71
  35. data/dist/es/@ember/application/tests/dependency_injection_test.js +0 -93
  36. data/dist/es/@ember/application/tests/initializers_test.js +0 -391
  37. data/dist/es/@ember/application/tests/instance_initializers_test.js +0 -395
  38. data/dist/es/@ember/application/tests/lazy_load_test.js +0 -79
  39. data/dist/es/@ember/application/tests/logging_test.js +0 -179
  40. data/dist/es/@ember/application/tests/readiness_test.js +0 -138
  41. data/dist/es/@ember/application/tests/reset_test.js +0 -185
  42. data/dist/es/@ember/application/tests/visit_test.js +0 -783
  43. data/dist/es/@ember/canary-features/index.js +0 -76
  44. data/dist/es/@ember/controller/index.js +0 -50
  45. data/dist/es/@ember/controller/lib/controller_mixin.js +0 -42
  46. data/dist/es/@ember/controller/tests/controller_test.js +0 -209
  47. data/dist/es/@ember/debug/index.js +0 -264
  48. data/dist/es/@ember/debug/lib/deprecate.js +0 -198
  49. data/dist/es/@ember/debug/lib/handlers.js +0 -22
  50. data/dist/es/@ember/debug/lib/testing.js +0 -7
  51. data/dist/es/@ember/debug/lib/warn.js +0 -107
  52. data/dist/es/@ember/debug/tests/handlers-test.js +0 -144
  53. data/dist/es/@ember/debug/tests/main_test.js +0 -444
  54. data/dist/es/@ember/deprecated-features/index.js +0 -21
  55. data/dist/es/@ember/engine/index.js +0 -532
  56. data/dist/es/@ember/engine/instance.js +0 -228
  57. data/dist/es/@ember/engine/lib/engine-parent.js +0 -32
  58. data/dist/es/@ember/engine/tests/engine_initializers_test.js +0 -366
  59. data/dist/es/@ember/engine/tests/engine_instance_initializers_test.js +0 -409
  60. data/dist/es/@ember/engine/tests/engine_instance_test.js +0 -115
  61. data/dist/es/@ember/engine/tests/engine_parent_test.js +0 -20
  62. data/dist/es/@ember/engine/tests/engine_test.js +0 -121
  63. data/dist/es/@ember/error/index.js +0 -36
  64. data/dist/es/@ember/error/tests/index_test.js +0 -19
  65. data/dist/es/@ember/instrumentation/index.js +0 -240
  66. data/dist/es/@ember/instrumentation/tests/index-test.js +0 -214
  67. data/dist/es/@ember/map/index.js +0 -218
  68. data/dist/es/@ember/map/lib/ordered-set.js +0 -186
  69. data/dist/es/@ember/map/lib/utils.js +0 -29
  70. data/dist/es/@ember/map/tests/map_test.js +0 -578
  71. data/dist/es/@ember/map/with-default.js +0 -87
  72. data/dist/es/@ember/object/computed.js +0 -35
  73. data/dist/es/@ember/object/lib/computed/computed_macros.js +0 -742
  74. data/dist/es/@ember/object/lib/computed/reduce_computed_macros.js +0 -894
  75. data/dist/es/@ember/object/tests/computed/computed_macros_test.js +0 -533
  76. data/dist/es/@ember/object/tests/computed/reduce_computed_macros_test.js +0 -2243
  77. data/dist/es/@ember/polyfills/index.js +0 -3
  78. data/dist/es/@ember/polyfills/lib/assign.js +0 -43
  79. data/dist/es/@ember/polyfills/lib/merge.js +0 -35
  80. data/dist/es/@ember/polyfills/tests/assign_test.js +0 -64
  81. data/dist/es/@ember/runloop/index.js +0 -749
  82. data/dist/es/@ember/runloop/tests/debounce_test.js +0 -87
  83. data/dist/es/@ember/runloop/tests/later_test.js +0 -264
  84. data/dist/es/@ember/runloop/tests/next_test.js +0 -56
  85. data/dist/es/@ember/runloop/tests/once_test.js +0 -62
  86. data/dist/es/@ember/runloop/tests/onerror_test.js +0 -59
  87. data/dist/es/@ember/runloop/tests/run_bind_test.js +0 -59
  88. data/dist/es/@ember/runloop/tests/run_test.js +0 -28
  89. data/dist/es/@ember/runloop/tests/schedule_test.js +0 -86
  90. data/dist/es/@ember/runloop/tests/sync_test.js +0 -32
  91. data/dist/es/@ember/runloop/tests/unwind_test.js +0 -54
  92. data/dist/es/@ember/service/index.js +0 -57
  93. data/dist/es/@ember/string/index.js +0 -362
  94. data/dist/es/@ember/string/lib/string_registry.js +0 -13
  95. data/dist/es/@ember/string/tests/camelize_test.js +0 -53
  96. data/dist/es/@ember/string/tests/capitalize_test.js +0 -58
  97. data/dist/es/@ember/string/tests/classify_test.js +0 -79
  98. data/dist/es/@ember/string/tests/dasherize_test.js +0 -57
  99. data/dist/es/@ember/string/tests/decamelize_test.js +0 -51
  100. data/dist/es/@ember/string/tests/loc_test.js +0 -76
  101. data/dist/es/@ember/string/tests/underscore_test.js +0 -51
  102. data/dist/es/@ember/string/tests/w_test.js +0 -39
  103. data/dist/es/@glimmer/compiler.js +0 -1226
  104. data/dist/es/@glimmer/encoder.js +0 -39
  105. data/dist/es/@glimmer/low-level.js +0 -82
  106. data/dist/es/@glimmer/node.js +0 -112
  107. data/dist/es/@glimmer/opcode-compiler.js +0 -1999
  108. data/dist/es/@glimmer/program.js +0 -405
  109. data/dist/es/@glimmer/reference.js +0 -478
  110. data/dist/es/@glimmer/runtime.js +0 -4086
  111. data/dist/es/@glimmer/syntax.js +0 -1424
  112. data/dist/es/@glimmer/util.js +0 -189
  113. data/dist/es/@glimmer/vm.js +0 -27
  114. data/dist/es/@glimmer/wire-format.js +0 -56
  115. data/dist/es/backburner.js +0 -936
  116. data/dist/es/container/index.js +0 -8
  117. data/dist/es/container/lib/container.js +0 -437
  118. data/dist/es/container/lib/registry.js +0 -646
  119. data/dist/es/container/tests/container_test.js +0 -872
  120. data/dist/es/container/tests/owner_test.js +0 -20
  121. data/dist/es/container/tests/registry_test.js +0 -943
  122. data/dist/es/dag-map.js +0 -209
  123. data/dist/es/ember-browser-environment/index.js +0 -8
  124. data/dist/es/ember-browser-environment/lib/has-dom.js +0 -19
  125. data/dist/es/ember-console/index.js +0 -177
  126. data/dist/es/ember-environment/index.js +0 -3
  127. data/dist/es/ember-environment/lib/context.js +0 -20
  128. data/dist/es/ember-environment/lib/env.js +0 -185
  129. data/dist/es/ember-environment/lib/global.js +0 -14
  130. data/dist/es/ember-error-handling/index.js +0 -22
  131. data/dist/es/ember-extension-support/index.js +0 -2
  132. data/dist/es/ember-extension-support/lib/container_debug_adapter.js +0 -99
  133. data/dist/es/ember-extension-support/lib/data_adapter.js +0 -493
  134. data/dist/es/ember-extension-support/tests/container_debug_adapter_test.js +0 -73
  135. data/dist/es/ember-extension-support/tests/data_adapter_test.js +0 -301
  136. data/dist/es/ember-glimmer/index.js +0 -286
  137. data/dist/es/ember-glimmer/lib/compile-time-lookup.js +0 -37
  138. data/dist/es/ember-glimmer/lib/component-managers/abstract.js +0 -49
  139. data/dist/es/ember-glimmer/lib/component-managers/curly.js +0 -395
  140. data/dist/es/ember-glimmer/lib/component-managers/custom.js +0 -145
  141. data/dist/es/ember-glimmer/lib/component-managers/definition-state.js +0 -1
  142. data/dist/es/ember-glimmer/lib/component-managers/mount.js +0 -103
  143. data/dist/es/ember-glimmer/lib/component-managers/outlet.js +0 -114
  144. data/dist/es/ember-glimmer/lib/component-managers/render.js +0 -112
  145. data/dist/es/ember-glimmer/lib/component-managers/root.js +0 -74
  146. data/dist/es/ember-glimmer/lib/component-managers/template-only.js +0 -46
  147. data/dist/es/ember-glimmer/lib/component.js +0 -633
  148. data/dist/es/ember-glimmer/lib/components/checkbox.js +0 -57
  149. data/dist/es/ember-glimmer/lib/components/link-to.js +0 -777
  150. data/dist/es/ember-glimmer/lib/components/text_area.js +0 -236
  151. data/dist/es/ember-glimmer/lib/components/text_field.js +0 -145
  152. data/dist/es/ember-glimmer/lib/dom.js +0 -3
  153. data/dist/es/ember-glimmer/lib/environment.js +0 -102
  154. data/dist/es/ember-glimmer/lib/helper.js +0 -128
  155. data/dist/es/ember-glimmer/lib/helpers/-class.js +0 -23
  156. data/dist/es/ember-glimmer/lib/helpers/-html-safe.js +0 -9
  157. data/dist/es/ember-glimmer/lib/helpers/-input-type.js +0 -11
  158. data/dist/es/ember-glimmer/lib/helpers/-normalize-class.js +0 -22
  159. data/dist/es/ember-glimmer/lib/helpers/action.js +0 -360
  160. data/dist/es/ember-glimmer/lib/helpers/component.js +0 -135
  161. data/dist/es/ember-glimmer/lib/helpers/concat.js +0 -38
  162. data/dist/es/ember-glimmer/lib/helpers/each-in.js +0 -126
  163. data/dist/es/ember-glimmer/lib/helpers/get.js +0 -100
  164. data/dist/es/ember-glimmer/lib/helpers/hash.js +0 -44
  165. data/dist/es/ember-glimmer/lib/helpers/if-unless.js +0 -142
  166. data/dist/es/ember-glimmer/lib/helpers/loc.js +0 -40
  167. data/dist/es/ember-glimmer/lib/helpers/log.js +0 -25
  168. data/dist/es/ember-glimmer/lib/helpers/mut.js +0 -107
  169. data/dist/es/ember-glimmer/lib/helpers/query-param.js +0 -31
  170. data/dist/es/ember-glimmer/lib/helpers/readonly.js +0 -104
  171. data/dist/es/ember-glimmer/lib/helpers/unbound.js +0 -36
  172. data/dist/es/ember-glimmer/lib/modifiers/action.js +0 -185
  173. data/dist/es/ember-glimmer/lib/protocol-for-url.js +0 -48
  174. data/dist/es/ember-glimmer/lib/renderer.js +0 -371
  175. data/dist/es/ember-glimmer/lib/resolver.js +0 -290
  176. data/dist/es/ember-glimmer/lib/setup-registry.js +0 -77
  177. data/dist/es/ember-glimmer/lib/syntax.js +0 -73
  178. data/dist/es/ember-glimmer/lib/syntax/-text-area.js +0 -8
  179. data/dist/es/ember-glimmer/lib/syntax/input.js +0 -173
  180. data/dist/es/ember-glimmer/lib/syntax/let.js +0 -50
  181. data/dist/es/ember-glimmer/lib/syntax/mount.js +0 -101
  182. data/dist/es/ember-glimmer/lib/syntax/outlet.js +0 -120
  183. data/dist/es/ember-glimmer/lib/syntax/render.js +0 -140
  184. data/dist/es/ember-glimmer/lib/syntax/utils.js +0 -6
  185. data/dist/es/ember-glimmer/lib/template-compiler.js +0 -7
  186. data/dist/es/ember-glimmer/lib/template.js +0 -16
  187. data/dist/es/ember-glimmer/lib/template_registry.js +0 -18
  188. data/dist/es/ember-glimmer/lib/templates/component.js +0 -2
  189. data/dist/es/ember-glimmer/lib/templates/empty.js +0 -2
  190. data/dist/es/ember-glimmer/lib/templates/link-to.js +0 -2
  191. data/dist/es/ember-glimmer/lib/templates/outlet.js +0 -2
  192. data/dist/es/ember-glimmer/lib/templates/root.js +0 -2
  193. data/dist/es/ember-glimmer/lib/utils/bindings.js +0 -180
  194. data/dist/es/ember-glimmer/lib/utils/curly-component-state-bucket.js +0 -36
  195. data/dist/es/ember-glimmer/lib/utils/custom-component-manager.js +0 -20
  196. data/dist/es/ember-glimmer/lib/utils/debug-stack.js +0 -57
  197. data/dist/es/ember-glimmer/lib/utils/iterable.js +0 -358
  198. data/dist/es/ember-glimmer/lib/utils/outlet.js +0 -89
  199. data/dist/es/ember-glimmer/lib/utils/process-args.js +0 -40
  200. data/dist/es/ember-glimmer/lib/utils/references.js +0 -325
  201. data/dist/es/ember-glimmer/lib/utils/serialization-first-node-helpers.js +0 -1
  202. data/dist/es/ember-glimmer/lib/utils/string.js +0 -98
  203. data/dist/es/ember-glimmer/lib/utils/to-bool.js +0 -9
  204. data/dist/es/ember-glimmer/lib/views/outlet.js +0 -71
  205. data/dist/es/ember-glimmer/tests/integration/application/actions-test.js +0 -107
  206. data/dist/es/ember-glimmer/tests/integration/application/engine-test.js +0 -912
  207. data/dist/es/ember-glimmer/tests/integration/application/rendering-test.js +0 -530
  208. data/dist/es/ember-glimmer/tests/integration/components/angle-bracket-invocation-test.js +0 -852
  209. data/dist/es/ember-glimmer/tests/integration/components/append-test.js +0 -742
  210. data/dist/es/ember-glimmer/tests/integration/components/attribute-bindings-test.js +0 -999
  211. data/dist/es/ember-glimmer/tests/integration/components/attrs-lookup-test.js +0 -268
  212. data/dist/es/ember-glimmer/tests/integration/components/class-bindings-test.js +0 -849
  213. data/dist/es/ember-glimmer/tests/integration/components/contextual-components-test.js +0 -1493
  214. data/dist/es/ember-glimmer/tests/integration/components/curly-components-test.js +0 -3705
  215. data/dist/es/ember-glimmer/tests/integration/components/destroy-test.js +0 -33
  216. data/dist/es/ember-glimmer/tests/integration/components/dynamic-components-test.js +0 -896
  217. data/dist/es/ember-glimmer/tests/integration/components/error-handling-test.js +0 -164
  218. data/dist/es/ember-glimmer/tests/integration/components/fragment-components-test.js +0 -285
  219. data/dist/es/ember-glimmer/tests/integration/components/instrumentation-compile-test.js +0 -108
  220. data/dist/es/ember-glimmer/tests/integration/components/instrumentation-test.js +0 -157
  221. data/dist/es/ember-glimmer/tests/integration/components/life-cycle-test.js +0 -1653
  222. data/dist/es/ember-glimmer/tests/integration/components/link-to-test.js +0 -218
  223. data/dist/es/ember-glimmer/tests/integration/components/local-lookup-test.js +0 -414
  224. data/dist/es/ember-glimmer/tests/integration/components/namespaced-lookup-test.js +0 -185
  225. data/dist/es/ember-glimmer/tests/integration/components/render-to-element-test.js +0 -0
  226. data/dist/es/ember-glimmer/tests/integration/components/target-action-test.js +0 -779
  227. data/dist/es/ember-glimmer/tests/integration/components/template-only-components-test.js +0 -225
  228. data/dist/es/ember-glimmer/tests/integration/components/to-string-test.js +0 -27
  229. data/dist/es/ember-glimmer/tests/integration/components/utils-test.js +0 -401
  230. data/dist/es/ember-glimmer/tests/integration/components/web-component-fallback-test.js +0 -35
  231. data/dist/es/ember-glimmer/tests/integration/components/will-destroy-element-hook-test.js +0 -40
  232. data/dist/es/ember-glimmer/tests/integration/content-test.js +0 -1759
  233. data/dist/es/ember-glimmer/tests/integration/custom-component-manager-test.js +0 -508
  234. data/dist/es/ember-glimmer/tests/integration/event-dispatcher-test.js +0 -607
  235. data/dist/es/ember-glimmer/tests/integration/helpers/-class-test.js +0 -76
  236. data/dist/es/ember-glimmer/tests/integration/helpers/closure-action-test.js +0 -1240
  237. data/dist/es/ember-glimmer/tests/integration/helpers/concat-test.js +0 -106
  238. data/dist/es/ember-glimmer/tests/integration/helpers/custom-helper-test.js +0 -672
  239. data/dist/es/ember-glimmer/tests/integration/helpers/element-action-test.js +0 -1595
  240. data/dist/es/ember-glimmer/tests/integration/helpers/get-test.js +0 -618
  241. data/dist/es/ember-glimmer/tests/integration/helpers/hash-test.js +0 -188
  242. data/dist/es/ember-glimmer/tests/integration/helpers/if-unless-test.js +0 -149
  243. data/dist/es/ember-glimmer/tests/integration/helpers/input-test.js +0 -827
  244. data/dist/es/ember-glimmer/tests/integration/helpers/loc-test.js +0 -103
  245. data/dist/es/ember-glimmer/tests/integration/helpers/log-test.js +0 -61
  246. data/dist/es/ember-glimmer/tests/integration/helpers/mut-test.js +0 -580
  247. data/dist/es/ember-glimmer/tests/integration/helpers/partial-test.js +0 -386
  248. data/dist/es/ember-glimmer/tests/integration/helpers/readonly-test.js +0 -293
  249. data/dist/es/ember-glimmer/tests/integration/helpers/render-test.js +0 -522
  250. data/dist/es/ember-glimmer/tests/integration/helpers/text-area-test.js +0 -166
  251. data/dist/es/ember-glimmer/tests/integration/helpers/unbound-test.js +0 -650
  252. data/dist/es/ember-glimmer/tests/integration/helpers/yield-test.js +0 -275
  253. data/dist/es/ember-glimmer/tests/integration/input-test.js +0 -242
  254. data/dist/es/ember-glimmer/tests/integration/mount-test.js +0 -424
  255. data/dist/es/ember-glimmer/tests/integration/outlet-test.js +0 -318
  256. data/dist/es/ember-glimmer/tests/integration/refinements-test.js +0 -74
  257. data/dist/es/ember-glimmer/tests/integration/render-settled-test.js +0 -72
  258. data/dist/es/ember-glimmer/tests/integration/svg-test.js +0 -158
  259. data/dist/es/ember-glimmer/tests/integration/syntax/each-in-test.js +0 -697
  260. data/dist/es/ember-glimmer/tests/integration/syntax/each-test.js +0 -1251
  261. data/dist/es/ember-glimmer/tests/integration/syntax/experimental-syntax-test.js +0 -42
  262. data/dist/es/ember-glimmer/tests/integration/syntax/if-unless-test.js +0 -108
  263. data/dist/es/ember-glimmer/tests/integration/syntax/in-element-test.js +0 -119
  264. data/dist/es/ember-glimmer/tests/integration/syntax/let-test.js +0 -390
  265. data/dist/es/ember-glimmer/tests/integration/syntax/with-dynamic-var-test.js +0 -36
  266. data/dist/es/ember-glimmer/tests/integration/syntax/with-test.js +0 -422
  267. data/dist/es/ember-glimmer/tests/unit/outlet-test.js +0 -48
  268. data/dist/es/ember-glimmer/tests/unit/runtime-resolver-cache-test.js +0 -263
  269. data/dist/es/ember-glimmer/tests/unit/template-factory-test.js +0 -67
  270. data/dist/es/ember-glimmer/tests/unit/utils/debug-stack-test.js +0 -38
  271. data/dist/es/ember-glimmer/tests/utils/abstract-test-case.js +0 -1
  272. data/dist/es/ember-glimmer/tests/utils/helpers.js +0 -15
  273. data/dist/es/ember-glimmer/tests/utils/shared-conditional-tests.js +0 -965
  274. data/dist/es/ember-glimmer/tests/utils/string-test.js +0 -47
  275. data/dist/es/ember-glimmer/tests/utils/test-case.js +0 -6
  276. data/dist/es/ember-glimmer/tests/utils/test-helpers.js +0 -1
  277. data/dist/es/ember-meta/index.js +0 -1
  278. data/dist/es/ember-meta/lib/meta.js +0 -623
  279. data/dist/es/ember-meta/tests/meta_test.js +0 -169
  280. data/dist/es/ember-metal/index.js +0 -33
  281. data/dist/es/ember-metal/lib/alias.js +0 -80
  282. data/dist/es/ember-metal/lib/array.js +0 -55
  283. data/dist/es/ember-metal/lib/array_events.js +0 -65
  284. data/dist/es/ember-metal/lib/chains.js +0 -315
  285. data/dist/es/ember-metal/lib/change_event.js +0 -4
  286. data/dist/es/ember-metal/lib/computed.js +0 -526
  287. data/dist/es/ember-metal/lib/computed_cache.js +0 -58
  288. data/dist/es/ember-metal/lib/dependent_keys.js +0 -34
  289. data/dist/es/ember-metal/lib/deprecate_property.js +0 -34
  290. data/dist/es/ember-metal/lib/descriptor.js +0 -28
  291. data/dist/es/ember-metal/lib/each_proxy.js +0 -106
  292. data/dist/es/ember-metal/lib/each_proxy_events.js +0 -13
  293. data/dist/es/ember-metal/lib/events.js +0 -174
  294. data/dist/es/ember-metal/lib/expand_properties.js +0 -64
  295. data/dist/es/ember-metal/lib/get_properties.js +0 -45
  296. data/dist/es/ember-metal/lib/injected_property.js +0 -53
  297. data/dist/es/ember-metal/lib/is_blank.js +0 -34
  298. data/dist/es/ember-metal/lib/is_empty.js +0 -63
  299. data/dist/es/ember-metal/lib/is_none.js +0 -27
  300. data/dist/es/ember-metal/lib/is_present.js +0 -38
  301. data/dist/es/ember-metal/lib/libraries.js +0 -80
  302. data/dist/es/ember-metal/lib/mixin.js +0 -646
  303. data/dist/es/ember-metal/lib/namespace_search.js +0 -166
  304. data/dist/es/ember-metal/lib/observer.js +0 -34
  305. data/dist/es/ember-metal/lib/observer_set.js +0 -48
  306. data/dist/es/ember-metal/lib/path_cache.js +0 -5
  307. data/dist/es/ember-metal/lib/properties.js +0 -192
  308. data/dist/es/ember-metal/lib/property_events.js +0 -198
  309. data/dist/es/ember-metal/lib/property_get.js +0 -160
  310. data/dist/es/ember-metal/lib/property_set.js +0 -157
  311. data/dist/es/ember-metal/lib/set_properties.js +0 -43
  312. data/dist/es/ember-metal/lib/tags.js +0 -81
  313. data/dist/es/ember-metal/lib/tracked.js +0 -201
  314. data/dist/es/ember-metal/lib/transaction.js +0 -137
  315. data/dist/es/ember-metal/lib/watch_key.js +0 -113
  316. data/dist/es/ember-metal/lib/watch_path.js +0 -24
  317. data/dist/es/ember-metal/lib/watching.js +0 -54
  318. data/dist/es/ember-metal/tests/accessors/get_path_test.js +0 -82
  319. data/dist/es/ember-metal/tests/accessors/get_properties_test.js +0 -36
  320. data/dist/es/ember-metal/tests/accessors/get_test.js +0 -335
  321. data/dist/es/ember-metal/tests/accessors/mandatory_setters_test.js +0 -470
  322. data/dist/es/ember-metal/tests/accessors/set_path_test.js +0 -97
  323. data/dist/es/ember-metal/tests/accessors/set_test.js +0 -128
  324. data/dist/es/ember-metal/tests/alias_test.js +0 -167
  325. data/dist/es/ember-metal/tests/chains_test.js +0 -210
  326. data/dist/es/ember-metal/tests/computed_test.js +0 -1040
  327. data/dist/es/ember-metal/tests/descriptor_test.js +0 -368
  328. data/dist/es/ember-metal/tests/events_test.js +0 -210
  329. data/dist/es/ember-metal/tests/expand_properties_test.js +0 -119
  330. data/dist/es/ember-metal/tests/injected_property_test.js +0 -76
  331. data/dist/es/ember-metal/tests/is_blank_test.js +0 -29
  332. data/dist/es/ember-metal/tests/is_empty_test.js +0 -55
  333. data/dist/es/ember-metal/tests/is_none_test.js +0 -23
  334. data/dist/es/ember-metal/tests/is_present_test.js +0 -30
  335. data/dist/es/ember-metal/tests/libraries_test.js +0 -99
  336. data/dist/es/ember-metal/tests/main_test.js +0 -31
  337. data/dist/es/ember-metal/tests/mixin/alias_method_test.js +0 -91
  338. data/dist/es/ember-metal/tests/mixin/apply_test.js +0 -40
  339. data/dist/es/ember-metal/tests/mixin/computed_test.js +0 -166
  340. data/dist/es/ember-metal/tests/mixin/concatenated_properties_test.js +0 -117
  341. data/dist/es/ember-metal/tests/mixin/detect_test.js +0 -40
  342. data/dist/es/ember-metal/tests/mixin/introspection_test.js +0 -75
  343. data/dist/es/ember-metal/tests/mixin/merged_properties_test.js +0 -200
  344. data/dist/es/ember-metal/tests/mixin/method_test.js +0 -252
  345. data/dist/es/ember-metal/tests/mixin/observer_test.js +0 -202
  346. data/dist/es/ember-metal/tests/mixin/reopen_test.js +0 -53
  347. data/dist/es/ember-metal/tests/mixin/without_test.js +0 -22
  348. data/dist/es/ember-metal/tests/namespace_search_test.js +0 -16
  349. data/dist/es/ember-metal/tests/observer_test.js +0 -961
  350. data/dist/es/ember-metal/tests/performance_test.js +0 -81
  351. data/dist/es/ember-metal/tests/properties_test.js +0 -120
  352. data/dist/es/ember-metal/tests/property_did_change_hook.js +0 -73
  353. data/dist/es/ember-metal/tests/set_properties_test.js +0 -49
  354. data/dist/es/ember-metal/tests/tracked/computed_test.js +0 -67
  355. data/dist/es/ember-metal/tests/tracked/get_test.js +0 -86
  356. data/dist/es/ember-metal/tests/tracked/set_test.js +0 -44
  357. data/dist/es/ember-metal/tests/tracked/support.js +0 -37
  358. data/dist/es/ember-metal/tests/tracked/validation_test.js +0 -233
  359. data/dist/es/ember-metal/tests/watching/is_watching_test.js +0 -97
  360. data/dist/es/ember-metal/tests/watching/unwatch_test.js +0 -109
  361. data/dist/es/ember-metal/tests/watching/watch_test.js +0 -255
  362. data/dist/es/ember-owner/index.js +0 -66
  363. data/dist/es/ember-routing/index.js +0 -21
  364. data/dist/es/ember-routing/lib/ext/controller.js +0 -222
  365. data/dist/es/ember-routing/lib/location/api.js +0 -118
  366. data/dist/es/ember-routing/lib/location/auto_location.js +0 -323
  367. data/dist/es/ember-routing/lib/location/hash_location.js +0 -171
  368. data/dist/es/ember-routing/lib/location/history_location.js +0 -298
  369. data/dist/es/ember-routing/lib/location/none_location.js +0 -122
  370. data/dist/es/ember-routing/lib/location/util.js +0 -114
  371. data/dist/es/ember-routing/lib/services/router.js +0 -243
  372. data/dist/es/ember-routing/lib/services/routing.js +0 -101
  373. data/dist/es/ember-routing/lib/system/cache.js +0 -40
  374. data/dist/es/ember-routing/lib/system/controller_for.js +0 -14
  375. data/dist/es/ember-routing/lib/system/dsl.js +0 -208
  376. data/dist/es/ember-routing/lib/system/generate_controller.js +0 -54
  377. data/dist/es/ember-routing/lib/system/query_params.js +0 -6
  378. data/dist/es/ember-routing/lib/system/route.js +0 -2476
  379. data/dist/es/ember-routing/lib/system/router.js +0 -1607
  380. data/dist/es/ember-routing/lib/system/router_state.js +0 -26
  381. data/dist/es/ember-routing/lib/system/transition.js +0 -153
  382. data/dist/es/ember-routing/lib/utils.js +0 -230
  383. data/dist/es/ember-routing/tests/ext/controller_test.js +0 -85
  384. data/dist/es/ember-routing/tests/location/auto_location_test.js +0 -379
  385. data/dist/es/ember-routing/tests/location/hash_location_test.js +0 -207
  386. data/dist/es/ember-routing/tests/location/history_location_test.js +0 -322
  387. data/dist/es/ember-routing/tests/location/none_location_test.js +0 -88
  388. data/dist/es/ember-routing/tests/location/util_test.js +0 -159
  389. data/dist/es/ember-routing/tests/system/cache_test.js +0 -54
  390. data/dist/es/ember-routing/tests/system/controller_for_test.js +0 -75
  391. data/dist/es/ember-routing/tests/system/dsl_test.js +0 -413
  392. data/dist/es/ember-routing/tests/system/route_test.js +0 -587
  393. data/dist/es/ember-routing/tests/system/router_test.js +0 -287
  394. data/dist/es/ember-routing/tests/utils_test.js +0 -37
  395. data/dist/es/ember-runtime/.gitignore +0 -1
  396. data/dist/es/ember-runtime/README +0 -12
  397. data/dist/es/ember-runtime/index.js +0 -35
  398. data/dist/es/ember-runtime/lib/compare.js +0 -149
  399. data/dist/es/ember-runtime/lib/copy.js +0 -106
  400. data/dist/es/ember-runtime/lib/ext/function.js +0 -154
  401. data/dist/es/ember-runtime/lib/ext/rsvp.js +0 -59
  402. data/dist/es/ember-runtime/lib/is-equal.js +0 -60
  403. data/dist/es/ember-runtime/lib/mixins/-proxy.js +0 -109
  404. data/dist/es/ember-runtime/lib/mixins/action_handler.js +0 -222
  405. data/dist/es/ember-runtime/lib/mixins/array.js +0 -1661
  406. data/dist/es/ember-runtime/lib/mixins/comparable.js +0 -38
  407. data/dist/es/ember-runtime/lib/mixins/container_proxy.js +0 -154
  408. data/dist/es/ember-runtime/lib/mixins/copyable.js +0 -34
  409. data/dist/es/ember-runtime/lib/mixins/enumerable.js +0 -16
  410. data/dist/es/ember-runtime/lib/mixins/evented.js +0 -149
  411. data/dist/es/ember-runtime/lib/mixins/mutable_enumerable.js +0 -18
  412. data/dist/es/ember-runtime/lib/mixins/observable.js +0 -482
  413. data/dist/es/ember-runtime/lib/mixins/promise_proxy.js +0 -224
  414. data/dist/es/ember-runtime/lib/mixins/registry_proxy.js +0 -265
  415. data/dist/es/ember-runtime/lib/mixins/target_action_support.js +0 -172
  416. data/dist/es/ember-runtime/lib/system/array_proxy.js +0 -298
  417. data/dist/es/ember-runtime/lib/system/core_object.js +0 -1037
  418. data/dist/es/ember-runtime/lib/system/namespace.js +0 -69
  419. data/dist/es/ember-runtime/lib/system/object.js +0 -73
  420. data/dist/es/ember-runtime/lib/system/object_proxy.js +0 -81
  421. data/dist/es/ember-runtime/lib/type-of.js +0 -107
  422. data/dist/es/ember-runtime/tests/array/any-test.js +0 -55
  423. data/dist/es/ember-runtime/tests/array/compact-test.js +0 -12
  424. data/dist/es/ember-runtime/tests/array/every-test.js +0 -82
  425. data/dist/es/ember-runtime/tests/array/filter-test.js +0 -123
  426. data/dist/es/ember-runtime/tests/array/find-test.js +0 -86
  427. data/dist/es/ember-runtime/tests/array/firstObject-test.js +0 -27
  428. data/dist/es/ember-runtime/tests/array/forEach-test.js +0 -68
  429. data/dist/es/ember-runtime/tests/array/includes-test.js +0 -46
  430. data/dist/es/ember-runtime/tests/array/indexOf-test.js +0 -27
  431. data/dist/es/ember-runtime/tests/array/invoke-test.js +0 -60
  432. data/dist/es/ember-runtime/tests/array/isAny-test.js +0 -53
  433. data/dist/es/ember-runtime/tests/array/lastIndexOf-test.js +0 -78
  434. data/dist/es/ember-runtime/tests/array/lastObject-test.js +0 -31
  435. data/dist/es/ember-runtime/tests/array/map-test.js +0 -68
  436. data/dist/es/ember-runtime/tests/array/mapBy-test.js +0 -16
  437. data/dist/es/ember-runtime/tests/array/objectAt-test.js +0 -34
  438. data/dist/es/ember-runtime/tests/array/reduce-test.js +0 -24
  439. data/dist/es/ember-runtime/tests/array/reject-test.js +0 -134
  440. data/dist/es/ember-runtime/tests/array/sortBy-test.js +0 -23
  441. data/dist/es/ember-runtime/tests/array/toArray-test.js +0 -11
  442. data/dist/es/ember-runtime/tests/array/uniq-test.js +0 -27
  443. data/dist/es/ember-runtime/tests/array/uniqBy-test.js +0 -33
  444. data/dist/es/ember-runtime/tests/array/without-test.js +0 -39
  445. data/dist/es/ember-runtime/tests/copyable-array/copy-test.js +0 -12
  446. data/dist/es/ember-runtime/tests/core/compare_test.js +0 -89
  447. data/dist/es/ember-runtime/tests/core/copy_test.js +0 -47
  448. data/dist/es/ember-runtime/tests/core/isEqual_test.js +0 -65
  449. data/dist/es/ember-runtime/tests/core/is_array_test.js +0 -59
  450. data/dist/es/ember-runtime/tests/core/is_empty_test.js +0 -15
  451. data/dist/es/ember-runtime/tests/core/type_of_test.js +0 -54
  452. data/dist/es/ember-runtime/tests/ext/function_test.js +0 -121
  453. data/dist/es/ember-runtime/tests/ext/rsvp_test.js +0 -269
  454. data/dist/es/ember-runtime/tests/helpers/array.js +0 -336
  455. data/dist/es/ember-runtime/tests/inject_test.js +0 -51
  456. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/chained_test.js +0 -63
  457. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js +0 -892
  458. data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js +0 -142
  459. data/dist/es/ember-runtime/tests/legacy_1x/system/object/base_test.js +0 -98
  460. data/dist/es/ember-runtime/tests/legacy_1x/system/object/concatenated_test.js +0 -131
  461. data/dist/es/ember-runtime/tests/mixins/array_test.js +0 -400
  462. data/dist/es/ember-runtime/tests/mixins/comparable_test.js +0 -37
  463. data/dist/es/ember-runtime/tests/mixins/container_proxy_test.js +0 -48
  464. data/dist/es/ember-runtime/tests/mixins/enumerable_test.js +0 -17
  465. data/dist/es/ember-runtime/tests/mixins/evented_test.js +0 -23
  466. data/dist/es/ember-runtime/tests/mixins/mutable_enumerable_test.js +0 -17
  467. data/dist/es/ember-runtime/tests/mixins/observable_test.js +0 -137
  468. data/dist/es/ember-runtime/tests/mixins/promise_proxy_test.js +0 -593
  469. data/dist/es/ember-runtime/tests/mixins/target_action_support_test.js +0 -237
  470. data/dist/es/ember-runtime/tests/mutable-array/addObject-test.js +0 -76
  471. data/dist/es/ember-runtime/tests/mutable-array/clear-test.js +0 -64
  472. data/dist/es/ember-runtime/tests/mutable-array/insertAt-test.js +0 -216
  473. data/dist/es/ember-runtime/tests/mutable-array/popObject-test.js +0 -91
  474. data/dist/es/ember-runtime/tests/mutable-array/pushObject-test.js +0 -98
  475. data/dist/es/ember-runtime/tests/mutable-array/pushObjects-test.js +0 -12
  476. data/dist/es/ember-runtime/tests/mutable-array/removeAt-test.js +0 -187
  477. data/dist/es/ember-runtime/tests/mutable-array/removeObject-test.js +0 -77
  478. data/dist/es/ember-runtime/tests/mutable-array/removeObjects-test.js +0 -202
  479. data/dist/es/ember-runtime/tests/mutable-array/replace-test.js +0 -221
  480. data/dist/es/ember-runtime/tests/mutable-array/reverseObjects-test.js +0 -35
  481. data/dist/es/ember-runtime/tests/mutable-array/setObjects-test.js +0 -63
  482. data/dist/es/ember-runtime/tests/mutable-array/shiftObject-test.js +0 -105
  483. data/dist/es/ember-runtime/tests/mutable-array/unshiftObject-test.js +0 -99
  484. data/dist/es/ember-runtime/tests/mutable-array/unshiftObjects-test.js +0 -102
  485. data/dist/es/ember-runtime/tests/system/array_proxy/arranged_content_test.js +0 -275
  486. data/dist/es/ember-runtime/tests/system/array_proxy/array_observer_test.js +0 -51
  487. data/dist/es/ember-runtime/tests/system/array_proxy/content_change_test.js +0 -85
  488. data/dist/es/ember-runtime/tests/system/array_proxy/length_test.js +0 -201
  489. data/dist/es/ember-runtime/tests/system/array_proxy/watching_and_listening_test.js +0 -157
  490. data/dist/es/ember-runtime/tests/system/core_object_test.js +0 -114
  491. data/dist/es/ember-runtime/tests/system/namespace/base_test.js +0 -175
  492. data/dist/es/ember-runtime/tests/system/native_array/a_test.js +0 -16
  493. data/dist/es/ember-runtime/tests/system/native_array/copyable_suite_test.js +0 -19
  494. data/dist/es/ember-runtime/tests/system/native_array/replace_test.js +0 -17
  495. data/dist/es/ember-runtime/tests/system/object/computed_test.js +0 -352
  496. data/dist/es/ember-runtime/tests/system/object/create_test.js +0 -135
  497. data/dist/es/ember-runtime/tests/system/object/destroy_test.js +0 -146
  498. data/dist/es/ember-runtime/tests/system/object/detectInstance_test.js +0 -38
  499. data/dist/es/ember-runtime/tests/system/object/detect_test.js +0 -33
  500. data/dist/es/ember-runtime/tests/system/object/es-compatibility-test.js +0 -469
  501. data/dist/es/ember-runtime/tests/system/object/events_test.js +0 -156
  502. data/dist/es/ember-runtime/tests/system/object/extend_test.js +0 -153
  503. data/dist/es/ember-runtime/tests/system/object/observer_test.js +0 -216
  504. data/dist/es/ember-runtime/tests/system/object/reopenClass_test.js +0 -36
  505. data/dist/es/ember-runtime/tests/system/object/reopen_test.js +0 -48
  506. data/dist/es/ember-runtime/tests/system/object/strict-mode-test.js +0 -31
  507. data/dist/es/ember-runtime/tests/system/object/toString_test.js +0 -125
  508. data/dist/es/ember-runtime/tests/system/object_proxy_test.js +0 -314
  509. data/dist/es/ember-template-compiler/index.js +0 -26
  510. data/dist/es/ember-template-compiler/lib/compat.js +0 -16
  511. data/dist/es/ember-template-compiler/lib/plugins/assert-if-helper-without-arguments.js +0 -38
  512. data/dist/es/ember-template-compiler/lib/plugins/assert-input-helper-without-block.js +0 -20
  513. data/dist/es/ember-template-compiler/lib/plugins/assert-reserved-named-arguments.js +0 -26
  514. data/dist/es/ember-template-compiler/lib/plugins/assert-splattribute-expression.js +0 -27
  515. data/dist/es/ember-template-compiler/lib/plugins/deprecate-render-model.js +0 -38
  516. data/dist/es/ember-template-compiler/lib/plugins/deprecate-render.js +0 -41
  517. data/dist/es/ember-template-compiler/lib/plugins/deprecate-send-action.js +0 -42
  518. data/dist/es/ember-template-compiler/lib/plugins/index.js +0 -50
  519. data/dist/es/ember-template-compiler/lib/plugins/transform-action-syntax.js +0 -52
  520. data/dist/es/ember-template-compiler/lib/plugins/transform-angle-bracket-components.js +0 -10
  521. data/dist/es/ember-template-compiler/lib/plugins/transform-attrs-into-args.js +0 -62
  522. data/dist/es/ember-template-compiler/lib/plugins/transform-dot-component-invocation.js +0 -88
  523. data/dist/es/ember-template-compiler/lib/plugins/transform-each-in-into-each.js +0 -48
  524. data/dist/es/ember-template-compiler/lib/plugins/transform-has-block-syntax.js +0 -46
  525. data/dist/es/ember-template-compiler/lib/plugins/transform-in-element.js +0 -83
  526. data/dist/es/ember-template-compiler/lib/plugins/transform-inline-link-to.js +0 -31
  527. data/dist/es/ember-template-compiler/lib/plugins/transform-input-type-syntax.js +0 -52
  528. data/dist/es/ember-template-compiler/lib/plugins/transform-old-binding-syntax.js +0 -48
  529. data/dist/es/ember-template-compiler/lib/plugins/transform-old-class-binding-syntax.js +0 -102
  530. data/dist/es/ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.js +0 -34
  531. data/dist/es/ember-template-compiler/lib/plugins/transform-top-level-components.js +0 -41
  532. data/dist/es/ember-template-compiler/lib/system/bootstrap.js +0 -44
  533. data/dist/es/ember-template-compiler/lib/system/calculate-location-display.js +0 -20
  534. data/dist/es/ember-template-compiler/lib/system/compile-options.js +0 -71
  535. data/dist/es/ember-template-compiler/lib/system/compile.js +0 -28
  536. data/dist/es/ember-template-compiler/lib/system/dasherize-component-name.js +0 -13
  537. data/dist/es/ember-template-compiler/lib/system/initializer.js +0 -22
  538. data/dist/es/ember-template-compiler/lib/system/precompile.js +0 -18
  539. data/dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js +0 -51
  540. data/dist/es/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js +0 -17
  541. data/dist/es/ember-template-compiler/tests/plugins/assert-reserved-named-arguments-test.js +0 -416
  542. data/dist/es/ember-template-compiler/tests/plugins/assert-splattribute-expression-test.js +0 -57
  543. data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-model-test.js +0 -19
  544. data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-test.js +0 -19
  545. data/dist/es/ember-template-compiler/tests/plugins/deprecate-send-action-test.js +0 -29
  546. data/dist/es/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js +0 -27
  547. data/dist/es/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js +0 -15
  548. data/dist/es/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js +0 -25
  549. data/dist/es/ember-template-compiler/tests/system/bootstrap-test.js +0 -155
  550. data/dist/es/ember-template-compiler/tests/system/compile_options_test.js +0 -115
  551. data/dist/es/ember-template-compiler/tests/system/dasherize-component-name-test.js +0 -19
  552. data/dist/es/ember-testing/index.js +0 -10
  553. data/dist/es/ember-testing/lib/adapters/adapter.js +0 -58
  554. data/dist/es/ember-testing/lib/adapters/qunit.js +0 -47
  555. data/dist/es/ember-testing/lib/events.js +0 -136
  556. data/dist/es/ember-testing/lib/ext/application.js +0 -191
  557. data/dist/es/ember-testing/lib/ext/rsvp.js +0 -19
  558. data/dist/es/ember-testing/lib/helpers.js +0 -30
  559. data/dist/es/ember-testing/lib/helpers/-is-form-control.js +0 -16
  560. data/dist/es/ember-testing/lib/helpers/and_then.js +0 -3
  561. data/dist/es/ember-testing/lib/helpers/click.js +0 -36
  562. data/dist/es/ember-testing/lib/helpers/current_path.js +0 -27
  563. data/dist/es/ember-testing/lib/helpers/current_route_name.js +0 -25
  564. data/dist/es/ember-testing/lib/helpers/current_url.js +0 -27
  565. data/dist/es/ember-testing/lib/helpers/fill_in.js +0 -46
  566. data/dist/es/ember-testing/lib/helpers/find.js +0 -41
  567. data/dist/es/ember-testing/lib/helpers/find_with_assert.js +0 -34
  568. data/dist/es/ember-testing/lib/helpers/key_event.js +0 -36
  569. data/dist/es/ember-testing/lib/helpers/pause_test.js +0 -65
  570. data/dist/es/ember-testing/lib/helpers/trigger_event.js +0 -62
  571. data/dist/es/ember-testing/lib/helpers/visit.js +0 -42
  572. data/dist/es/ember-testing/lib/helpers/wait.js +0 -72
  573. data/dist/es/ember-testing/lib/initializers.js +0 -17
  574. data/dist/es/ember-testing/lib/setup_for_testing.js +0 -44
  575. data/dist/es/ember-testing/lib/support.js +0 -62
  576. data/dist/es/ember-testing/lib/test.js +0 -70
  577. data/dist/es/ember-testing/lib/test/adapter.js +0 -33
  578. data/dist/es/ember-testing/lib/test/helpers.js +0 -125
  579. data/dist/es/ember-testing/lib/test/on_inject_helpers.js +0 -38
  580. data/dist/es/ember-testing/lib/test/pending_requests.js +0 -24
  581. data/dist/es/ember-testing/lib/test/promise.js +0 -79
  582. data/dist/es/ember-testing/lib/test/run.js +0 -9
  583. data/dist/es/ember-testing/lib/test/waiters.js +0 -117
  584. data/dist/es/ember-testing/tests/acceptance_test.js +0 -478
  585. data/dist/es/ember-testing/tests/adapters/adapter_test.js +0 -31
  586. data/dist/es/ember-testing/tests/adapters/qunit_test.js +0 -50
  587. data/dist/es/ember-testing/tests/adapters_test.js +0 -405
  588. data/dist/es/ember-testing/tests/ext/rsvp_test.js +0 -124
  589. data/dist/es/ember-testing/tests/helper_registration_test.js +0 -98
  590. data/dist/es/ember-testing/tests/helpers_test.js +0 -1228
  591. data/dist/es/ember-testing/tests/integration_test.js +0 -106
  592. data/dist/es/ember-testing/tests/reexports_test.js +0 -26
  593. data/dist/es/ember-testing/tests/test/waiters-test.js +0 -145
  594. data/dist/es/ember-utils/index.js +0 -28
  595. data/dist/es/ember-utils/lib/cache.js +0 -36
  596. data/dist/es/ember-utils/lib/dictionary.js +0 -11
  597. data/dist/es/ember-utils/lib/guid.js +0 -120
  598. data/dist/es/ember-utils/lib/inspect.js +0 -112
  599. data/dist/es/ember-utils/lib/intern.js +0 -49
  600. data/dist/es/ember-utils/lib/invoke.js +0 -53
  601. data/dist/es/ember-utils/lib/is_proxy.js +0 -14
  602. data/dist/es/ember-utils/lib/lookup-descriptor.js +0 -11
  603. data/dist/es/ember-utils/lib/make-array.js +0 -7
  604. data/dist/es/ember-utils/lib/name.js +0 -9
  605. data/dist/es/ember-utils/lib/proxy-utils.js +0 -1
  606. data/dist/es/ember-utils/lib/spec.js +0 -14
  607. data/dist/es/ember-utils/lib/super.js +0 -83
  608. data/dist/es/ember-utils/lib/symbol-utils.js +0 -8
  609. data/dist/es/ember-utils/lib/symbol.js +0 -15
  610. data/dist/es/ember-utils/lib/to-string.js +0 -35
  611. data/dist/es/ember-utils/lib/weak_set.js +0 -18
  612. data/dist/es/ember-utils/tests/cache_test.js +0 -77
  613. data/dist/es/ember-utils/tests/can_invoke_test.js +0 -46
  614. data/dist/es/ember-utils/tests/checkHasSuper_test.js +0 -17
  615. data/dist/es/ember-utils/tests/generate_guid_test.js +0 -13
  616. data/dist/es/ember-utils/tests/guid_for_test.js +0 -101
  617. data/dist/es/ember-utils/tests/inspect_test.js +0 -146
  618. data/dist/es/ember-utils/tests/is_proxy_test.js +0 -18
  619. data/dist/es/ember-utils/tests/make_array_test.js +0 -41
  620. data/dist/es/ember-utils/tests/to-string-test.js +0 -32
  621. data/dist/es/ember-utils/tests/try_invoke_test.js +0 -48
  622. data/dist/es/ember-views/index.js +0 -28
  623. data/dist/es/ember-views/lib/compat/attrs.js +0 -3
  624. data/dist/es/ember-views/lib/compat/fallback-view-registry.js +0 -3
  625. data/dist/es/ember-views/lib/component_lookup.js +0 -27
  626. data/dist/es/ember-views/lib/mixins/action_support.js +0 -189
  627. data/dist/es/ember-views/lib/mixins/child_views_support.js +0 -27
  628. data/dist/es/ember-views/lib/mixins/class_names_support.js +0 -102
  629. data/dist/es/ember-views/lib/mixins/text_support.js +0 -333
  630. data/dist/es/ember-views/lib/mixins/view_state_support.js +0 -19
  631. data/dist/es/ember-views/lib/mixins/view_support.js +0 -452
  632. data/dist/es/ember-views/lib/system/action_manager.js +0 -14
  633. data/dist/es/ember-views/lib/system/event_dispatcher.js +0 -454
  634. data/dist/es/ember-views/lib/system/jquery.js +0 -29
  635. data/dist/es/ember-views/lib/system/jquery_event_deprecation.js +0 -61
  636. data/dist/es/ember-views/lib/system/lookup_partial.js +0 -55
  637. data/dist/es/ember-views/lib/system/utils.js +0 -201
  638. data/dist/es/ember-views/lib/utils/lookup-component.js +0 -58
  639. data/dist/es/ember-views/lib/views/core_view.js +0 -83
  640. data/dist/es/ember-views/lib/views/states.js +0 -48
  641. data/dist/es/ember-views/lib/views/states/default.js +0 -17
  642. data/dist/es/ember-views/lib/views/states/destroying.js +0 -16
  643. data/dist/es/ember-views/lib/views/states/has_element.js +0 -31
  644. data/dist/es/ember-views/lib/views/states/in_dom.js +0 -28
  645. data/dist/es/ember-views/lib/views/states/pre_render.js +0 -3
  646. data/dist/es/ember/index.js +0 -645
  647. data/dist/es/ember/tests/application_lifecycle_test.js +0 -188
  648. data/dist/es/ember/tests/component_context_test.js +0 -255
  649. data/dist/es/ember/tests/component_registration_test.js +0 -252
  650. data/dist/es/ember/tests/controller_test.js +0 -44
  651. data/dist/es/ember/tests/error_handler_test.js +0 -581
  652. data/dist/es/ember/tests/helpers/helper_registration_test.js +0 -103
  653. data/dist/es/ember/tests/helpers/link_to_test.js +0 -2103
  654. data/dist/es/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js +0 -342
  655. data/dist/es/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js +0 -694
  656. data/dist/es/ember/tests/homepage_example_test.js +0 -47
  657. data/dist/es/ember/tests/integration/multiple-app-test.js +0 -101
  658. data/dist/es/ember/tests/production_build_test.js +0 -34
  659. data/dist/es/ember/tests/reexports_test.js +0 -307
  660. data/dist/es/ember/tests/routing/decoupled_basic_test.js +0 -4506
  661. data/dist/es/ember/tests/routing/query_params_test.js +0 -1579
  662. data/dist/es/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js +0 -1117
  663. data/dist/es/ember/tests/routing/query_params_test/overlapping_query_params_test.js +0 -185
  664. data/dist/es/ember/tests/routing/query_params_test/query_param_async_get_handler_test.js +0 -327
  665. data/dist/es/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js +0 -37
  666. data/dist/es/ember/tests/routing/query_params_test/shared_state_test.js +0 -84
  667. data/dist/es/ember/tests/routing/router_map_test.js +0 -46
  668. data/dist/es/ember/tests/routing/router_service_test/basic_test.js +0 -95
  669. data/dist/es/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js +0 -149
  670. data/dist/es/ember/tests/routing/router_service_test/isActive_test.js +0 -113
  671. data/dist/es/ember/tests/routing/router_service_test/replaceWith_test.js +0 -144
  672. data/dist/es/ember/tests/routing/router_service_test/transitionTo_test.js +0 -370
  673. data/dist/es/ember/tests/routing/router_service_test/urlFor_test.js +0 -307
  674. data/dist/es/ember/tests/routing/substates_test.js +0 -1110
  675. data/dist/es/ember/tests/routing/toplevel_dom_test.js +0 -37
  676. data/dist/es/ember/tests/service_injection_test.js +0 -278
  677. data/dist/es/ember/tests/view_instrumentation_test.js +0 -47
  678. data/dist/es/ember/version.js +0 -1
  679. data/dist/es/handlebars.js +0 -1268
  680. data/dist/es/internal-test-helpers/index.js +0 -31
  681. data/dist/es/internal-test-helpers/lib/.gitkeep +0 -0
  682. data/dist/es/internal-test-helpers/lib/apply-mixins.js +0 -37
  683. data/dist/es/internal-test-helpers/lib/browser-detect.js +0 -4
  684. data/dist/es/internal-test-helpers/lib/build-owner.js +0 -49
  685. data/dist/es/internal-test-helpers/lib/confirm-export.js +0 -45
  686. data/dist/es/internal-test-helpers/lib/ember-dev/assertion.js +0 -87
  687. data/dist/es/internal-test-helpers/lib/ember-dev/containers.js +0 -34
  688. data/dist/es/internal-test-helpers/lib/ember-dev/debug.js +0 -47
  689. data/dist/es/internal-test-helpers/lib/ember-dev/deprecation.js +0 -71
  690. data/dist/es/internal-test-helpers/lib/ember-dev/index.js +0 -19
  691. data/dist/es/internal-test-helpers/lib/ember-dev/method-call-tracker.js +0 -127
  692. data/dist/es/internal-test-helpers/lib/ember-dev/namespaces.js +0 -34
  693. data/dist/es/internal-test-helpers/lib/ember-dev/run-loop.js +0 -28
  694. data/dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js +0 -26
  695. data/dist/es/internal-test-helpers/lib/ember-dev/utils.js +0 -33
  696. data/dist/es/internal-test-helpers/lib/ember-dev/warning.js +0 -71
  697. data/dist/es/internal-test-helpers/lib/equal-inner-html.js +0 -37
  698. data/dist/es/internal-test-helpers/lib/equal-tokens.js +0 -53
  699. data/dist/es/internal-test-helpers/lib/factory.js +0 -65
  700. data/dist/es/internal-test-helpers/lib/get-all-property-names.js +0 -12
  701. data/dist/es/internal-test-helpers/lib/get-text-of.js +0 -3
  702. data/dist/es/internal-test-helpers/lib/matchers.js +0 -167
  703. data/dist/es/internal-test-helpers/lib/module-for.js +0 -89
  704. data/dist/es/internal-test-helpers/lib/registry-check.js +0 -28
  705. data/dist/es/internal-test-helpers/lib/run.js +0 -11
  706. data/dist/es/internal-test-helpers/lib/strip.js +0 -12
  707. data/dist/es/internal-test-helpers/lib/system/synthetic-events.js +0 -183
  708. data/dist/es/internal-test-helpers/lib/test-cases/abstract-application.js +0 -70
  709. data/dist/es/internal-test-helpers/lib/test-cases/abstract-rendering.js +0 -203
  710. data/dist/es/internal-test-helpers/lib/test-cases/abstract.js +0 -222
  711. data/dist/es/internal-test-helpers/lib/test-cases/application.js +0 -39
  712. data/dist/es/internal-test-helpers/lib/test-cases/autoboot-application.js +0 -34
  713. data/dist/es/internal-test-helpers/lib/test-cases/default-resolver-application.js +0 -43
  714. data/dist/es/internal-test-helpers/lib/test-cases/node-query.js +0 -120
  715. data/dist/es/internal-test-helpers/lib/test-cases/query-param.js +0 -124
  716. data/dist/es/internal-test-helpers/lib/test-cases/rendering.js +0 -14
  717. data/dist/es/internal-test-helpers/lib/test-cases/router.js +0 -26
  718. data/dist/es/internal-test-helpers/lib/test-cases/test-resolver-application.js +0 -40
  719. data/dist/es/internal-test-helpers/lib/test-resolver.js +0 -86
  720. data/dist/es/internal-test-helpers/tests/index-test.js +0 -10
  721. data/dist/es/route-recognizer.js +0 -685
  722. data/dist/es/router.js +0 -2454
  723. data/dist/es/rsvp.js +0 -2394
  724. data/dist/es/simple-html-tokenizer.js +0 -638
  725. data/dist/jquery/jquery.js +0 -10364
  726. data/dist/node/app-boot-test.js +0 -146
  727. data/dist/node/build-info-test.js +0 -177
  728. data/dist/node/component-rendering-test.js +0 -34
  729. data/dist/node/helpers/app-module.js +0 -198
  730. data/dist/node/helpers/assert-html-matches.js +0 -25
  731. data/dist/node/helpers/build-owner.js +0 -28
  732. data/dist/node/helpers/component-module.js +0 -137
  733. data/dist/node/sourcemap-test.js +0 -27
  734. data/dist/node/template-compiler-test.js +0 -45
  735. data/dist/node/visit-test.js +0 -349
  736. data/dist/qunit/qunit.css +0 -436
  737. data/dist/qunit/qunit.js +0 -5188
  738. data/dist/tests/index.html +0 -254
  739. data/ember-source.gemspec +0 -28
  740. data/node_modules/.yarn-integrity +0 -10
  741. data/yarn.lock +0 -4
data/dist/es/rsvp.js DELETED
@@ -1,2394 +0,0 @@
1
- function callbacksFor(object) {
2
- let callbacks = object._promiseCallbacks;
3
-
4
- if (!callbacks) {
5
- callbacks = object._promiseCallbacks = {};
6
- }
7
-
8
- return callbacks;
9
- }
10
-
11
- /**
12
- @class RSVP.EventTarget
13
- */
14
- var EventTarget = {
15
-
16
- /**
17
- `RSVP.EventTarget.mixin` extends an object with EventTarget methods. For
18
- Example:
19
-
20
- ```javascript
21
- let object = {};
22
-
23
- RSVP.EventTarget.mixin(object);
24
-
25
- object.on('finished', function(event) {
26
- // handle event
27
- });
28
-
29
- object.trigger('finished', { detail: value });
30
- ```
31
-
32
- `EventTarget.mixin` also works with prototypes:
33
-
34
- ```javascript
35
- let Person = function() {};
36
- RSVP.EventTarget.mixin(Person.prototype);
37
-
38
- let yehuda = new Person();
39
- let tom = new Person();
40
-
41
- yehuda.on('poke', function(event) {
42
- console.log('Yehuda says OW');
43
- });
44
-
45
- tom.on('poke', function(event) {
46
- console.log('Tom says OW');
47
- });
48
-
49
- yehuda.trigger('poke');
50
- tom.trigger('poke');
51
- ```
52
-
53
- @method mixin
54
- @for RSVP.EventTarget
55
- @private
56
- @param {Object} object object to extend with EventTarget methods
57
- */
58
- mixin(object) {
59
- object.on = this.on;
60
- object.off = this.off;
61
- object.trigger = this.trigger;
62
- object._promiseCallbacks = undefined;
63
- return object;
64
- },
65
-
66
- /**
67
- Registers a callback to be executed when `eventName` is triggered
68
-
69
- ```javascript
70
- object.on('event', function(eventInfo){
71
- // handle the event
72
- });
73
-
74
- object.trigger('event');
75
- ```
76
-
77
- @method on
78
- @for RSVP.EventTarget
79
- @private
80
- @param {String} eventName name of the event to listen for
81
- @param {Function} callback function to be called when the event is triggered.
82
- */
83
- on(eventName, callback) {
84
- if (typeof callback !== 'function') {
85
- throw new TypeError('Callback must be a function');
86
- }
87
-
88
- let allCallbacks = callbacksFor(this);
89
- let callbacks = allCallbacks[eventName];
90
-
91
- if (!callbacks) {
92
- callbacks = allCallbacks[eventName] = [];
93
- }
94
-
95
- if (callbacks.indexOf(callback) === -1) {
96
- callbacks.push(callback);
97
- }
98
- },
99
-
100
- /**
101
- You can use `off` to stop firing a particular callback for an event:
102
-
103
- ```javascript
104
- function doStuff() { // do stuff! }
105
- object.on('stuff', doStuff);
106
-
107
- object.trigger('stuff'); // doStuff will be called
108
-
109
- // Unregister ONLY the doStuff callback
110
- object.off('stuff', doStuff);
111
- object.trigger('stuff'); // doStuff will NOT be called
112
- ```
113
-
114
- If you don't pass a `callback` argument to `off`, ALL callbacks for the
115
- event will not be executed when the event fires. For example:
116
-
117
- ```javascript
118
- let callback1 = function(){};
119
- let callback2 = function(){};
120
-
121
- object.on('stuff', callback1);
122
- object.on('stuff', callback2);
123
-
124
- object.trigger('stuff'); // callback1 and callback2 will be executed.
125
-
126
- object.off('stuff');
127
- object.trigger('stuff'); // callback1 and callback2 will not be executed!
128
- ```
129
-
130
- @method off
131
- @for RSVP.EventTarget
132
- @private
133
- @param {String} eventName event to stop listening to
134
- @param {Function} callback optional argument. If given, only the function
135
- given will be removed from the event's callback queue. If no `callback`
136
- argument is given, all callbacks will be removed from the event's callback
137
- queue.
138
- */
139
- off(eventName, callback) {
140
- let allCallbacks = callbacksFor(this);
141
-
142
- if (!callback) {
143
- allCallbacks[eventName] = [];
144
- return;
145
- }
146
-
147
- let callbacks = allCallbacks[eventName];
148
- let index = callbacks.indexOf(callback);
149
-
150
- if (index !== -1) {
151
- callbacks.splice(index, 1);
152
- }
153
- },
154
-
155
- /**
156
- Use `trigger` to fire custom events. For example:
157
-
158
- ```javascript
159
- object.on('foo', function(){
160
- console.log('foo event happened!');
161
- });
162
- object.trigger('foo');
163
- // 'foo event happened!' logged to the console
164
- ```
165
-
166
- You can also pass a value as a second argument to `trigger` that will be
167
- passed as an argument to all event listeners for the event:
168
-
169
- ```javascript
170
- object.on('foo', function(value){
171
- console.log(value.name);
172
- });
173
-
174
- object.trigger('foo', { name: 'bar' });
175
- // 'bar' logged to the console
176
- ```
177
-
178
- @method trigger
179
- @for RSVP.EventTarget
180
- @private
181
- @param {String} eventName name of the event to be triggered
182
- @param {*} options optional value to be passed to any event handlers for
183
- the given `eventName`
184
- */
185
- trigger(eventName, options, label) {
186
- let allCallbacks = callbacksFor(this);
187
-
188
- let callbacks = allCallbacks[eventName];
189
- if (callbacks) {
190
- // Don't cache the callbacks.length since it may grow
191
- let callback;
192
- for (let i = 0; i < callbacks.length; i++) {
193
- callback = callbacks[i];
194
- callback(options, label);
195
- }
196
- }
197
- }
198
- };
199
-
200
- const config = {
201
- instrument: false
202
- };
203
-
204
- EventTarget['mixin'](config);
205
-
206
- function configure(name, value) {
207
- if (arguments.length === 2) {
208
- config[name] = value;
209
- } else {
210
- return config[name];
211
- }
212
- }
213
-
214
- const queue = [];
215
-
216
- function scheduleFlush() {
217
- setTimeout(() => {
218
- for (let i = 0; i < queue.length; i++) {
219
- let entry = queue[i];
220
-
221
- let payload = entry.payload;
222
-
223
- payload.guid = payload.key + payload.id;
224
- payload.childGuid = payload.key + payload.childId;
225
- if (payload.error) {
226
- payload.stack = payload.error.stack;
227
- }
228
-
229
- config['trigger'](entry.name, entry.payload);
230
- }
231
- queue.length = 0;
232
- }, 50);
233
- }
234
-
235
- function instrument(eventName, promise, child) {
236
- if (1 === queue.push({
237
- name: eventName,
238
- payload: {
239
- key: promise._guidKey,
240
- id: promise._id,
241
- eventName: eventName,
242
- detail: promise._result,
243
- childId: child && child._id,
244
- label: promise._label,
245
- timeStamp: Date.now(),
246
- error: config["instrument-with-stack"] ? new Error(promise._label) : null
247
- }})) {
248
- scheduleFlush();
249
- }
250
- }
251
-
252
- /**
253
- `RSVP.Promise.resolve` returns a promise that will become resolved with the
254
- passed `value`. It is shorthand for the following:
255
-
256
- ```javascript
257
- let promise = new RSVP.Promise(function(resolve, reject){
258
- resolve(1);
259
- });
260
-
261
- promise.then(function(value){
262
- // value === 1
263
- });
264
- ```
265
-
266
- Instead of writing the above, your code now simply becomes the following:
267
-
268
- ```javascript
269
- let promise = RSVP.Promise.resolve(1);
270
-
271
- promise.then(function(value){
272
- // value === 1
273
- });
274
- ```
275
-
276
- @method resolve
277
- @static
278
- @param {*} object value that the returned promise will be resolved with
279
- @param {String} label optional string for identifying the returned promise.
280
- Useful for tooling.
281
- @return {Promise} a promise that will become fulfilled with the given
282
- `value`
283
- */
284
- function resolve$$1(object, label) {
285
- /*jshint validthis:true */
286
- let Constructor = this;
287
-
288
- if (object && typeof object === 'object' && object.constructor === Constructor) {
289
- return object;
290
- }
291
-
292
- let promise = new Constructor(noop, label);
293
- resolve$1(promise, object);
294
- return promise;
295
- }
296
-
297
- function withOwnPromise() {
298
- return new TypeError('A promises callback cannot return that same promise.');
299
- }
300
-
301
- function objectOrFunction(x) {
302
- let type = typeof x;
303
- return x !== null && (type === 'object' || type === 'function');
304
- }
305
-
306
- function noop() {}
307
-
308
- const PENDING = void 0;
309
- const FULFILLED = 1;
310
- const REJECTED = 2;
311
-
312
- const TRY_CATCH_ERROR = { error: null };
313
-
314
- function getThen(promise) {
315
- try {
316
- return promise.then;
317
- } catch(error) {
318
- TRY_CATCH_ERROR.error = error;
319
- return TRY_CATCH_ERROR;
320
- }
321
- }
322
-
323
- let tryCatchCallback;
324
- function tryCatcher() {
325
- try {
326
- let target = tryCatchCallback;
327
- tryCatchCallback = null;
328
- return target.apply(this, arguments);
329
- } catch(e) {
330
- TRY_CATCH_ERROR.error = e;
331
- return TRY_CATCH_ERROR;
332
- }
333
- }
334
-
335
- function tryCatch(fn) {
336
- tryCatchCallback = fn;
337
- return tryCatcher;
338
- }
339
-
340
- function handleForeignThenable(promise, thenable, then$$1) {
341
- config.async(promise => {
342
- let sealed = false;
343
- let result = tryCatch(then$$1).call(
344
- thenable,
345
- value => {
346
- if (sealed) { return; }
347
- sealed = true;
348
- if (thenable === value) {
349
- fulfill(promise, value);
350
- } else {
351
- resolve$1(promise, value);
352
- }
353
- },
354
- reason => {
355
- if (sealed) { return; }
356
- sealed = true;
357
-
358
- reject(promise, reason);
359
- },
360
- 'Settle: ' + (promise._label || ' unknown promise')
361
- );
362
-
363
- if (!sealed && result === TRY_CATCH_ERROR) {
364
- sealed = true;
365
- let error = TRY_CATCH_ERROR.error;
366
- TRY_CATCH_ERROR.error = null;
367
- reject(promise, error);
368
- }
369
-
370
- }, promise);
371
- }
372
-
373
- function handleOwnThenable(promise, thenable) {
374
- if (thenable._state === FULFILLED) {
375
- fulfill(promise, thenable._result);
376
- } else if (thenable._state === REJECTED) {
377
- thenable._onError = null;
378
- reject(promise, thenable._result);
379
- } else {
380
- subscribe(thenable, undefined, value => {
381
- if (thenable === value) {
382
- fulfill(promise, value);
383
- } else {
384
- resolve$1(promise, value);
385
- }
386
- }, reason => reject(promise, reason));
387
- }
388
- }
389
-
390
- function handleMaybeThenable(promise, maybeThenable, then$$1) {
391
- let isOwnThenable =
392
- maybeThenable.constructor === promise.constructor &&
393
- then$$1 === then &&
394
- promise.constructor.resolve === resolve$$1;
395
-
396
- if (isOwnThenable) {
397
- handleOwnThenable(promise, maybeThenable);
398
- } else if (then$$1 === TRY_CATCH_ERROR) {
399
- let error = TRY_CATCH_ERROR.error;
400
- TRY_CATCH_ERROR.error = null;
401
- reject(promise, error);
402
- } else if (typeof then$$1 === 'function') {
403
- handleForeignThenable(promise, maybeThenable, then$$1);
404
- } else {
405
- fulfill(promise, maybeThenable);
406
- }
407
- }
408
-
409
- function resolve$1(promise, value) {
410
- if (promise === value) {
411
- fulfill(promise, value);
412
- } else if (objectOrFunction(value)) {
413
- handleMaybeThenable(promise, value, getThen(value));
414
- } else {
415
- fulfill(promise, value);
416
- }
417
- }
418
-
419
- function publishRejection(promise) {
420
- if (promise._onError) {
421
- promise._onError(promise._result);
422
- }
423
-
424
- publish(promise);
425
- }
426
-
427
- function fulfill(promise, value) {
428
- if (promise._state !== PENDING) { return; }
429
-
430
- promise._result = value;
431
- promise._state = FULFILLED;
432
-
433
- if (promise._subscribers.length === 0) {
434
- if (config.instrument) {
435
- instrument('fulfilled', promise);
436
- }
437
- } else {
438
- config.async(publish, promise);
439
- }
440
- }
441
-
442
- function reject(promise, reason) {
443
- if (promise._state !== PENDING) { return; }
444
- promise._state = REJECTED;
445
- promise._result = reason;
446
- config.async(publishRejection, promise);
447
- }
448
-
449
- function subscribe(parent, child, onFulfillment, onRejection) {
450
- let subscribers = parent._subscribers;
451
- let length = subscribers.length;
452
-
453
- parent._onError = null;
454
-
455
- subscribers[length] = child;
456
- subscribers[length + FULFILLED] = onFulfillment;
457
- subscribers[length + REJECTED] = onRejection;
458
-
459
- if (length === 0 && parent._state) {
460
- config.async(publish, parent);
461
- }
462
- }
463
-
464
- function publish(promise) {
465
- let subscribers = promise._subscribers;
466
- let settled = promise._state;
467
-
468
- if (config.instrument) {
469
- instrument(settled === FULFILLED ? 'fulfilled' : 'rejected', promise);
470
- }
471
-
472
- if (subscribers.length === 0) { return; }
473
-
474
- let child, callback, result = promise._result;
475
-
476
- for (let i = 0; i < subscribers.length; i += 3) {
477
- child = subscribers[i];
478
- callback = subscribers[i + settled];
479
-
480
- if (child) {
481
- invokeCallback(settled, child, callback, result);
482
- } else {
483
- callback(result);
484
- }
485
- }
486
-
487
- promise._subscribers.length = 0;
488
- }
489
-
490
- function invokeCallback(state, promise, callback, result) {
491
- let hasCallback = typeof callback === 'function';
492
- let value;
493
-
494
- if (hasCallback) {
495
- value = tryCatch(callback)(result);
496
- } else {
497
- value = result;
498
- }
499
-
500
- if (promise._state !== PENDING) {
501
- // noop
502
- } else if (value === promise) {
503
- reject(promise, withOwnPromise());
504
- } else if (value === TRY_CATCH_ERROR) {
505
- let error = TRY_CATCH_ERROR.error;
506
- TRY_CATCH_ERROR.error = null; // release
507
- reject(promise, error);
508
- } else if (hasCallback) {
509
- resolve$1(promise, value);
510
- } else if (state === FULFILLED) {
511
- fulfill(promise, value);
512
- } else if (state === REJECTED) {
513
- reject(promise, value);
514
- }
515
- }
516
-
517
- function initializePromise(promise, resolver) {
518
- let resolved = false;
519
- try {
520
- resolver(value => {
521
- if (resolved) { return; }
522
- resolved = true;
523
- resolve$1(promise, value);
524
- }, reason => {
525
- if (resolved) { return; }
526
- resolved = true;
527
- reject(promise, reason);
528
- });
529
- } catch(e) {
530
- reject(promise, e);
531
- }
532
- }
533
-
534
- function then(onFulfillment, onRejection, label) {
535
- let parent = this;
536
- let state = parent._state;
537
-
538
- if (state === FULFILLED && !onFulfillment || state === REJECTED && !onRejection) {
539
- config.instrument && instrument('chained', parent, parent);
540
- return parent;
541
- }
542
-
543
- parent._onError = null;
544
-
545
- let child = new parent.constructor(noop, label);
546
- let result = parent._result;
547
-
548
- config.instrument && instrument('chained', parent, child);
549
-
550
- if (state === PENDING) {
551
- subscribe(parent, child, onFulfillment, onRejection);
552
- } else {
553
- let callback = state === FULFILLED ? onFulfillment : onRejection;
554
- config.async(() => invokeCallback(state, child, callback, result));
555
- }
556
-
557
- return child;
558
- }
559
-
560
- class Enumerator {
561
- constructor(Constructor, input, abortOnReject, label) {
562
- this._instanceConstructor = Constructor;
563
- this.promise = new Constructor(noop, label);
564
- this._abortOnReject = abortOnReject;
565
- this._isUsingOwnPromise = Constructor === Promise;
566
- this._isUsingOwnResolve = Constructor.resolve === resolve$$1;
567
-
568
- this._init(...arguments);
569
- }
570
-
571
- _init(Constructor, input) {
572
- let len = input.length || 0;
573
- this.length = len;
574
- this._remaining = len;
575
- this._result = new Array(len);
576
-
577
- this._enumerate(input);
578
- }
579
-
580
- _enumerate(input) {
581
- let length = this.length;
582
- let promise = this.promise;
583
-
584
- for (let i = 0; promise._state === PENDING && i < length; i++) {
585
- this._eachEntry(input[i], i, true);
586
- }
587
- this._checkFullfillment();
588
- }
589
-
590
- _checkFullfillment() {
591
- if (this._remaining === 0) {
592
- let result = this._result;
593
- fulfill(this.promise, result);
594
- this._result = null;
595
- }
596
- }
597
-
598
- _settleMaybeThenable(entry, i, firstPass) {
599
- let c = this._instanceConstructor;
600
-
601
- if (this._isUsingOwnResolve) {
602
- let then$$1 = getThen(entry);
603
-
604
- if (then$$1 === then && entry._state !== PENDING) {
605
- entry._onError = null;
606
- this._settledAt(entry._state, i, entry._result, firstPass);
607
- } else if (typeof then$$1 !== 'function') {
608
- this._settledAt(FULFILLED, i, entry, firstPass);
609
- } else if (this._isUsingOwnPromise) {
610
- let promise = new c(noop);
611
- handleMaybeThenable(promise, entry, then$$1);
612
- this._willSettleAt(promise, i, firstPass);
613
- } else {
614
- this._willSettleAt(new c(resolve => resolve(entry)), i, firstPass);
615
- }
616
- } else {
617
- this._willSettleAt(c.resolve(entry), i, firstPass);
618
- }
619
- }
620
-
621
- _eachEntry(entry, i, firstPass) {
622
- if (entry !== null && typeof entry === 'object') {
623
- this._settleMaybeThenable(entry, i, firstPass);
624
- } else {
625
- this._setResultAt(FULFILLED, i, entry, firstPass);
626
- }
627
- }
628
-
629
- _settledAt(state, i, value, firstPass) {
630
- let promise = this.promise;
631
-
632
- if (promise._state === PENDING) {
633
- if (this._abortOnReject && state === REJECTED) {
634
- reject(promise, value);
635
- } else {
636
- this._setResultAt(state, i, value, firstPass);
637
- this._checkFullfillment();
638
- }
639
- }
640
- }
641
-
642
- _setResultAt(state, i, value, firstPass) {
643
- this._remaining--;
644
- this._result[i] = value;
645
- }
646
-
647
- _willSettleAt(promise, i, firstPass) {
648
- subscribe(
649
- promise, undefined,
650
- value => this._settledAt(FULFILLED, i, value, firstPass),
651
- reason => this._settledAt(REJECTED, i, reason, firstPass)
652
- );
653
- }
654
- }
655
-
656
- function setSettledResult(state, i, value) {
657
- this._remaining--;
658
- if (state === FULFILLED) {
659
- this._result[i] = {
660
- state: 'fulfilled',
661
- value: value
662
- };
663
- } else {
664
- this._result[i] = {
665
- state: 'rejected',
666
- reason: value
667
- };
668
- }
669
- }
670
-
671
- /**
672
- `RSVP.Promise.all` accepts an array of promises, and returns a new promise which
673
- is fulfilled with an array of fulfillment values for the passed promises, or
674
- rejected with the reason of the first passed promise to be rejected. It casts all
675
- elements of the passed iterable to promises as it runs this algorithm.
676
-
677
- Example:
678
-
679
- ```javascript
680
- let promise1 = RSVP.resolve(1);
681
- let promise2 = RSVP.resolve(2);
682
- let promise3 = RSVP.resolve(3);
683
- let promises = [ promise1, promise2, promise3 ];
684
-
685
- RSVP.Promise.all(promises).then(function(array){
686
- // The array here would be [ 1, 2, 3 ];
687
- });
688
- ```
689
-
690
- If any of the `promises` given to `RSVP.all` are rejected, the first promise
691
- that is rejected will be given as an argument to the returned promises's
692
- rejection handler. For example:
693
-
694
- Example:
695
-
696
- ```javascript
697
- let promise1 = RSVP.resolve(1);
698
- let promise2 = RSVP.reject(new Error("2"));
699
- let promise3 = RSVP.reject(new Error("3"));
700
- let promises = [ promise1, promise2, promise3 ];
701
-
702
- RSVP.Promise.all(promises).then(function(array){
703
- // Code here never runs because there are rejected promises!
704
- }, function(error) {
705
- // error.message === "2"
706
- });
707
- ```
708
-
709
- @method all
710
- @static
711
- @param {Array} entries array of promises
712
- @param {String} label optional string for labeling the promise.
713
- Useful for tooling.
714
- @return {Promise} promise that is fulfilled when all `promises` have been
715
- fulfilled, or rejected if any of them become rejected.
716
- @static
717
- */
718
- function all(entries, label) {
719
- if (!Array.isArray(entries)) {
720
- return this.reject(new TypeError("Promise.all must be called with an array"), label);
721
- }
722
- return new Enumerator(this, entries, true /* abort on reject */, label).promise;
723
- }
724
-
725
- /**
726
- `RSVP.Promise.race` returns a new promise which is settled in the same way as the
727
- first passed promise to settle.
728
-
729
- Example:
730
-
731
- ```javascript
732
- let promise1 = new RSVP.Promise(function(resolve, reject){
733
- setTimeout(function(){
734
- resolve('promise 1');
735
- }, 200);
736
- });
737
-
738
- let promise2 = new RSVP.Promise(function(resolve, reject){
739
- setTimeout(function(){
740
- resolve('promise 2');
741
- }, 100);
742
- });
743
-
744
- RSVP.Promise.race([promise1, promise2]).then(function(result){
745
- // result === 'promise 2' because it was resolved before promise1
746
- // was resolved.
747
- });
748
- ```
749
-
750
- `RSVP.Promise.race` is deterministic in that only the state of the first
751
- settled promise matters. For example, even if other promises given to the
752
- `promises` array argument are resolved, but the first settled promise has
753
- become rejected before the other promises became fulfilled, the returned
754
- promise will become rejected:
755
-
756
- ```javascript
757
- let promise1 = new RSVP.Promise(function(resolve, reject){
758
- setTimeout(function(){
759
- resolve('promise 1');
760
- }, 200);
761
- });
762
-
763
- let promise2 = new RSVP.Promise(function(resolve, reject){
764
- setTimeout(function(){
765
- reject(new Error('promise 2'));
766
- }, 100);
767
- });
768
-
769
- RSVP.Promise.race([promise1, promise2]).then(function(result){
770
- // Code here never runs
771
- }, function(reason){
772
- // reason.message === 'promise 2' because promise 2 became rejected before
773
- // promise 1 became fulfilled
774
- });
775
- ```
776
-
777
- An example real-world use case is implementing timeouts:
778
-
779
- ```javascript
780
- RSVP.Promise.race([ajax('foo.json'), timeout(5000)])
781
- ```
782
-
783
- @method race
784
- @static
785
- @param {Array} entries array of promises to observe
786
- @param {String} label optional string for describing the promise returned.
787
- Useful for tooling.
788
- @return {Promise} a promise which settles in the same way as the first passed
789
- promise to settle.
790
- */
791
- function race(entries, label) {
792
- /*jshint validthis:true */
793
- let Constructor = this;
794
-
795
- let promise = new Constructor(noop, label);
796
-
797
- if (!Array.isArray(entries)) {
798
- reject(promise, new TypeError('Promise.race must be called with an array'));
799
- return promise;
800
- }
801
-
802
- for (let i = 0; promise._state === PENDING && i < entries.length; i++) {
803
- subscribe(
804
- Constructor.resolve(entries[i]), undefined,
805
- value => resolve$1(promise, value),
806
- reason => reject(promise, reason)
807
- );
808
- }
809
-
810
- return promise;
811
- }
812
-
813
- /**
814
- `RSVP.Promise.reject` returns a promise rejected with the passed `reason`.
815
- It is shorthand for the following:
816
-
817
- ```javascript
818
- let promise = new RSVP.Promise(function(resolve, reject){
819
- reject(new Error('WHOOPS'));
820
- });
821
-
822
- promise.then(function(value){
823
- // Code here doesn't run because the promise is rejected!
824
- }, function(reason){
825
- // reason.message === 'WHOOPS'
826
- });
827
- ```
828
-
829
- Instead of writing the above, your code now simply becomes the following:
830
-
831
- ```javascript
832
- let promise = RSVP.Promise.reject(new Error('WHOOPS'));
833
-
834
- promise.then(function(value){
835
- // Code here doesn't run because the promise is rejected!
836
- }, function(reason){
837
- // reason.message === 'WHOOPS'
838
- });
839
- ```
840
-
841
- @method reject
842
- @static
843
- @param {*} reason value that the returned promise will be rejected with.
844
- @param {String} label optional string for identifying the returned promise.
845
- Useful for tooling.
846
- @return {Promise} a promise rejected with the given `reason`.
847
- */
848
- function reject$1(reason, label) {
849
- /*jshint validthis:true */
850
- let Constructor = this;
851
- let promise = new Constructor(noop, label);
852
- reject(promise, reason);
853
- return promise;
854
- }
855
-
856
- const guidKey = 'rsvp_' + Date.now() + '-';
857
- let counter = 0;
858
-
859
- function needsResolver() {
860
- throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
861
- }
862
-
863
- function needsNew() {
864
- throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
865
- }
866
-
867
- /**
868
- Promise objects represent the eventual result of an asynchronous operation. The
869
- primary way of interacting with a promise is through its `then` method, which
870
- registers callbacks to receive either a promise’s eventual value or the reason
871
- why the promise cannot be fulfilled.
872
-
873
- Terminology
874
- -----------
875
-
876
- - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
877
- - `thenable` is an object or function that defines a `then` method.
878
- - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
879
- - `exception` is a value that is thrown using the throw statement.
880
- - `reason` is a value that indicates why a promise was rejected.
881
- - `settled` the final resting state of a promise, fulfilled or rejected.
882
-
883
- A promise can be in one of three states: pending, fulfilled, or rejected.
884
-
885
- Promises that are fulfilled have a fulfillment value and are in the fulfilled
886
- state. Promises that are rejected have a rejection reason and are in the
887
- rejected state. A fulfillment value is never a thenable.
888
-
889
- Promises can also be said to *resolve* a value. If this value is also a
890
- promise, then the original promise's settled state will match the value's
891
- settled state. So a promise that *resolves* a promise that rejects will
892
- itself reject, and a promise that *resolves* a promise that fulfills will
893
- itself fulfill.
894
-
895
-
896
- Basic Usage:
897
- ------------
898
-
899
- ```js
900
- let promise = new Promise(function(resolve, reject) {
901
- // on success
902
- resolve(value);
903
-
904
- // on failure
905
- reject(reason);
906
- });
907
-
908
- promise.then(function(value) {
909
- // on fulfillment
910
- }, function(reason) {
911
- // on rejection
912
- });
913
- ```
914
-
915
- Advanced Usage:
916
- ---------------
917
-
918
- Promises shine when abstracting away asynchronous interactions such as
919
- `XMLHttpRequest`s.
920
-
921
- ```js
922
- function getJSON(url) {
923
- return new Promise(function(resolve, reject){
924
- let xhr = new XMLHttpRequest();
925
-
926
- xhr.open('GET', url);
927
- xhr.onreadystatechange = handler;
928
- xhr.responseType = 'json';
929
- xhr.setRequestHeader('Accept', 'application/json');
930
- xhr.send();
931
-
932
- function handler() {
933
- if (this.readyState === this.DONE) {
934
- if (this.status === 200) {
935
- resolve(this.response);
936
- } else {
937
- reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
938
- }
939
- }
940
- };
941
- });
942
- }
943
-
944
- getJSON('/posts.json').then(function(json) {
945
- // on fulfillment
946
- }, function(reason) {
947
- // on rejection
948
- });
949
- ```
950
-
951
- Unlike callbacks, promises are great composable primitives.
952
-
953
- ```js
954
- Promise.all([
955
- getJSON('/posts'),
956
- getJSON('/comments')
957
- ]).then(function(values){
958
- values[0] // => postsJSON
959
- values[1] // => commentsJSON
960
-
961
- return values;
962
- });
963
- ```
964
-
965
- @class RSVP.Promise
966
- @param {function} resolver
967
- @param {String} label optional string for labeling the promise.
968
- Useful for tooling.
969
- @constructor
970
- */
971
- class Promise {
972
- constructor(resolver, label) {
973
- this._id = counter++;
974
- this._label = label;
975
- this._state = undefined;
976
- this._result = undefined;
977
- this._subscribers = [];
978
-
979
- config.instrument && instrument('created', this);
980
-
981
- if (noop !== resolver) {
982
- typeof resolver !== 'function' && needsResolver();
983
- this instanceof Promise ? initializePromise(this, resolver) : needsNew();
984
- }
985
- }
986
-
987
- _onError(reason) {
988
- config.after(() => {
989
- if (this._onError) {
990
- config.trigger('error', reason, this._label);
991
- }
992
- });
993
- }
994
-
995
- /**
996
- `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
997
- as the catch block of a try/catch statement.
998
-
999
- ```js
1000
- function findAuthor(){
1001
- throw new Error('couldn\'t find that author');
1002
- }
1003
-
1004
- // synchronous
1005
- try {
1006
- findAuthor();
1007
- } catch(reason) {
1008
- // something went wrong
1009
- }
1010
-
1011
- // async with promises
1012
- findAuthor().catch(function(reason){
1013
- // something went wrong
1014
- });
1015
- ```
1016
-
1017
- @method catch
1018
- @param {Function} onRejection
1019
- @param {String} label optional string for labeling the promise.
1020
- Useful for tooling.
1021
- @return {Promise}
1022
- */
1023
- catch(onRejection, label) {
1024
- return this.then(undefined, onRejection, label);
1025
- }
1026
-
1027
- /**
1028
- `finally` will be invoked regardless of the promise's fate just as native
1029
- try/catch/finally behaves
1030
-
1031
- Synchronous example:
1032
-
1033
- ```js
1034
- findAuthor() {
1035
- if (Math.random() > 0.5) {
1036
- throw new Error();
1037
- }
1038
- return new Author();
1039
- }
1040
-
1041
- try {
1042
- return findAuthor(); // succeed or fail
1043
- } catch(error) {
1044
- return findOtherAuthor();
1045
- } finally {
1046
- // always runs
1047
- // doesn't affect the return value
1048
- }
1049
- ```
1050
-
1051
- Asynchronous example:
1052
-
1053
- ```js
1054
- findAuthor().catch(function(reason){
1055
- return findOtherAuthor();
1056
- }).finally(function(){
1057
- // author was either found, or not
1058
- });
1059
- ```
1060
-
1061
- @method finally
1062
- @param {Function} callback
1063
- @param {String} label optional string for labeling the promise.
1064
- Useful for tooling.
1065
- @return {Promise}
1066
- */
1067
- finally(callback, label) {
1068
- let promise = this;
1069
- let constructor = promise.constructor;
1070
-
1071
- return promise.then(value => constructor.resolve(callback()).then(() => value),
1072
- reason => constructor.resolve(callback()).then(() => { throw reason; }), label);
1073
- }
1074
- }
1075
-
1076
- Promise.cast = resolve$$1; // deprecated
1077
- Promise.all = all;
1078
- Promise.race = race;
1079
- Promise.resolve = resolve$$1;
1080
- Promise.reject = reject$1;
1081
-
1082
- Promise.prototype._guidKey = guidKey;
1083
-
1084
- /**
1085
- The primary way of interacting with a promise is through its `then` method,
1086
- which registers callbacks to receive either a promise's eventual value or the
1087
- reason why the promise cannot be fulfilled.
1088
-
1089
- ```js
1090
- findUser().then(function(user){
1091
- // user is available
1092
- }, function(reason){
1093
- // user is unavailable, and you are given the reason why
1094
- });
1095
- ```
1096
-
1097
- Chaining
1098
- --------
1099
-
1100
- The return value of `then` is itself a promise. This second, 'downstream'
1101
- promise is resolved with the return value of the first promise's fulfillment
1102
- or rejection handler, or rejected if the handler throws an exception.
1103
-
1104
- ```js
1105
- findUser().then(function (user) {
1106
- return user.name;
1107
- }, function (reason) {
1108
- return 'default name';
1109
- }).then(function (userName) {
1110
- // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
1111
- // will be `'default name'`
1112
- });
1113
-
1114
- findUser().then(function (user) {
1115
- throw new Error('Found user, but still unhappy');
1116
- }, function (reason) {
1117
- throw new Error('`findUser` rejected and we\'re unhappy');
1118
- }).then(function (value) {
1119
- // never reached
1120
- }, function (reason) {
1121
- // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
1122
- // If `findUser` rejected, `reason` will be '`findUser` rejected and we\'re unhappy'.
1123
- });
1124
- ```
1125
- If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
1126
-
1127
- ```js
1128
- findUser().then(function (user) {
1129
- throw new PedagogicalException('Upstream error');
1130
- }).then(function (value) {
1131
- // never reached
1132
- }).then(function (value) {
1133
- // never reached
1134
- }, function (reason) {
1135
- // The `PedgagocialException` is propagated all the way down to here
1136
- });
1137
- ```
1138
-
1139
- Assimilation
1140
- ------------
1141
-
1142
- Sometimes the value you want to propagate to a downstream promise can only be
1143
- retrieved asynchronously. This can be achieved by returning a promise in the
1144
- fulfillment or rejection handler. The downstream promise will then be pending
1145
- until the returned promise is settled. This is called *assimilation*.
1146
-
1147
- ```js
1148
- findUser().then(function (user) {
1149
- return findCommentsByAuthor(user);
1150
- }).then(function (comments) {
1151
- // The user's comments are now available
1152
- });
1153
- ```
1154
-
1155
- If the assimliated promise rejects, then the downstream promise will also reject.
1156
-
1157
- ```js
1158
- findUser().then(function (user) {
1159
- return findCommentsByAuthor(user);
1160
- }).then(function (comments) {
1161
- // If `findCommentsByAuthor` fulfills, we'll have the value here
1162
- }, function (reason) {
1163
- // If `findCommentsByAuthor` rejects, we'll have the reason here
1164
- });
1165
- ```
1166
-
1167
- Simple Example
1168
- --------------
1169
-
1170
- Synchronous Example
1171
-
1172
- ```javascript
1173
- let result;
1174
-
1175
- try {
1176
- result = findResult();
1177
- // success
1178
- } catch(reason) {
1179
- // failure
1180
- }
1181
- ```
1182
-
1183
- Errback Example
1184
-
1185
- ```js
1186
- findResult(function(result, err){
1187
- if (err) {
1188
- // failure
1189
- } else {
1190
- // success
1191
- }
1192
- });
1193
- ```
1194
-
1195
- Promise Example;
1196
-
1197
- ```javascript
1198
- findResult().then(function(result){
1199
- // success
1200
- }, function(reason){
1201
- // failure
1202
- });
1203
- ```
1204
-
1205
- Advanced Example
1206
- --------------
1207
-
1208
- Synchronous Example
1209
-
1210
- ```javascript
1211
- let author, books;
1212
-
1213
- try {
1214
- author = findAuthor();
1215
- books = findBooksByAuthor(author);
1216
- // success
1217
- } catch(reason) {
1218
- // failure
1219
- }
1220
- ```
1221
-
1222
- Errback Example
1223
-
1224
- ```js
1225
-
1226
- function foundBooks(books) {
1227
-
1228
- }
1229
-
1230
- function failure(reason) {
1231
-
1232
- }
1233
-
1234
- findAuthor(function(author, err){
1235
- if (err) {
1236
- failure(err);
1237
- // failure
1238
- } else {
1239
- try {
1240
- findBoooksByAuthor(author, function(books, err) {
1241
- if (err) {
1242
- failure(err);
1243
- } else {
1244
- try {
1245
- foundBooks(books);
1246
- } catch(reason) {
1247
- failure(reason);
1248
- }
1249
- }
1250
- });
1251
- } catch(error) {
1252
- failure(err);
1253
- }
1254
- // success
1255
- }
1256
- });
1257
- ```
1258
-
1259
- Promise Example;
1260
-
1261
- ```javascript
1262
- findAuthor().
1263
- then(findBooksByAuthor).
1264
- then(function(books){
1265
- // found books
1266
- }).catch(function(reason){
1267
- // something went wrong
1268
- });
1269
- ```
1270
-
1271
- @method then
1272
- @param {Function} onFulfillment
1273
- @param {Function} onRejection
1274
- @param {String} label optional string for labeling the promise.
1275
- Useful for tooling.
1276
- @return {Promise}
1277
- */
1278
- Promise.prototype.then = then;
1279
-
1280
- function makeObject(_, argumentNames) {
1281
- let obj = {};
1282
- let length = _.length;
1283
- let args = new Array(length);
1284
-
1285
- for (let x = 0; x < length; x++) {
1286
- args[x] = _[x];
1287
- }
1288
-
1289
- for (let i = 0; i < argumentNames.length; i++) {
1290
- let name = argumentNames[i];
1291
- obj[name] = args[i + 1];
1292
- }
1293
-
1294
- return obj;
1295
- }
1296
-
1297
- function arrayResult(_) {
1298
- let length = _.length;
1299
- let args = new Array(length - 1);
1300
-
1301
- for (let i = 1; i < length; i++) {
1302
- args[i - 1] = _[i];
1303
- }
1304
-
1305
- return args;
1306
- }
1307
-
1308
- function wrapThenable(then, promise) {
1309
- return {
1310
- then(onFulFillment, onRejection) {
1311
- return then.call(promise, onFulFillment, onRejection);
1312
- }
1313
- };
1314
- }
1315
-
1316
- /**
1317
- `RSVP.denodeify` takes a 'node-style' function and returns a function that
1318
- will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the
1319
- browser when you'd prefer to use promises over using callbacks. For example,
1320
- `denodeify` transforms the following:
1321
-
1322
- ```javascript
1323
- let fs = require('fs');
1324
-
1325
- fs.readFile('myfile.txt', function(err, data){
1326
- if (err) return handleError(err);
1327
- handleData(data);
1328
- });
1329
- ```
1330
-
1331
- into:
1332
-
1333
- ```javascript
1334
- let fs = require('fs');
1335
- let readFile = RSVP.denodeify(fs.readFile);
1336
-
1337
- readFile('myfile.txt').then(handleData, handleError);
1338
- ```
1339
-
1340
- If the node function has multiple success parameters, then `denodeify`
1341
- just returns the first one:
1342
-
1343
- ```javascript
1344
- let request = RSVP.denodeify(require('request'));
1345
-
1346
- request('http://example.com').then(function(res) {
1347
- // ...
1348
- });
1349
- ```
1350
-
1351
- However, if you need all success parameters, setting `denodeify`'s
1352
- second parameter to `true` causes it to return all success parameters
1353
- as an array:
1354
-
1355
- ```javascript
1356
- let request = RSVP.denodeify(require('request'), true);
1357
-
1358
- request('http://example.com').then(function(result) {
1359
- // result[0] -> res
1360
- // result[1] -> body
1361
- });
1362
- ```
1363
-
1364
- Or if you pass it an array with names it returns the parameters as a hash:
1365
-
1366
- ```javascript
1367
- let request = RSVP.denodeify(require('request'), ['res', 'body']);
1368
-
1369
- request('http://example.com').then(function(result) {
1370
- // result.res
1371
- // result.body
1372
- });
1373
- ```
1374
-
1375
- Sometimes you need to retain the `this`:
1376
-
1377
- ```javascript
1378
- let app = require('express')();
1379
- let render = RSVP.denodeify(app.render.bind(app));
1380
- ```
1381
-
1382
- The denodified function inherits from the original function. It works in all
1383
- environments, except IE 10 and below. Consequently all properties of the original
1384
- function are available to you. However, any properties you change on the
1385
- denodeified function won't be changed on the original function. Example:
1386
-
1387
- ```javascript
1388
- let request = RSVP.denodeify(require('request')),
1389
- cookieJar = request.jar(); // <- Inheritance is used here
1390
-
1391
- request('http://example.com', {jar: cookieJar}).then(function(res) {
1392
- // cookieJar.cookies holds now the cookies returned by example.com
1393
- });
1394
- ```
1395
-
1396
- Using `denodeify` makes it easier to compose asynchronous operations instead
1397
- of using callbacks. For example, instead of:
1398
-
1399
- ```javascript
1400
- let fs = require('fs');
1401
-
1402
- fs.readFile('myfile.txt', function(err, data){
1403
- if (err) { ... } // Handle error
1404
- fs.writeFile('myfile2.txt', data, function(err){
1405
- if (err) { ... } // Handle error
1406
- console.log('done')
1407
- });
1408
- });
1409
- ```
1410
-
1411
- you can chain the operations together using `then` from the returned promise:
1412
-
1413
- ```javascript
1414
- let fs = require('fs');
1415
- let readFile = RSVP.denodeify(fs.readFile);
1416
- let writeFile = RSVP.denodeify(fs.writeFile);
1417
-
1418
- readFile('myfile.txt').then(function(data){
1419
- return writeFile('myfile2.txt', data);
1420
- }).then(function(){
1421
- console.log('done')
1422
- }).catch(function(error){
1423
- // Handle error
1424
- });
1425
- ```
1426
-
1427
- @method denodeify
1428
- @static
1429
- @for RSVP
1430
- @param {Function} nodeFunc a 'node-style' function that takes a callback as
1431
- its last argument. The callback expects an error to be passed as its first
1432
- argument (if an error occurred, otherwise null), and the value from the
1433
- operation as its second argument ('function(err, value){ }').
1434
- @param {Boolean|Array} [options] An optional paramter that if set
1435
- to `true` causes the promise to fulfill with the callback's success arguments
1436
- as an array. This is useful if the node function has multiple success
1437
- paramters. If you set this paramter to an array with names, the promise will
1438
- fulfill with a hash with these names as keys and the success parameters as
1439
- values.
1440
- @return {Function} a function that wraps `nodeFunc` to return an
1441
- `RSVP.Promise`
1442
- @static
1443
- */
1444
- function denodeify(nodeFunc, options) {
1445
- let fn = function() {
1446
- let l = arguments.length;
1447
- let args = new Array(l + 1);
1448
- let promiseInput = false;
1449
-
1450
- for (let i = 0; i < l; ++i) {
1451
- let arg = arguments[i];
1452
-
1453
- if (!promiseInput) {
1454
- // TODO: clean this up
1455
- promiseInput = needsPromiseInput(arg);
1456
- if (promiseInput === TRY_CATCH_ERROR) {
1457
- let error = TRY_CATCH_ERROR.error;
1458
- TRY_CATCH_ERROR.error = null;
1459
- let p = new Promise(noop);
1460
- reject(p, error);
1461
- return p;
1462
- } else if (promiseInput && promiseInput !== true) {
1463
- arg = wrapThenable(promiseInput, arg);
1464
- }
1465
- }
1466
- args[i] = arg;
1467
- }
1468
-
1469
- let promise = new Promise(noop);
1470
-
1471
- args[l] = function(err, val) {
1472
- if (err) {
1473
- reject(promise, err);
1474
- } else if (options === undefined) {
1475
- resolve$1(promise, val);
1476
- } else if (options === true) {
1477
- resolve$1(promise, arrayResult(arguments));
1478
- } else if (Array.isArray(options)) {
1479
- resolve$1(promise, makeObject(arguments, options));
1480
- } else {
1481
- resolve$1(promise, val);
1482
- }
1483
- };
1484
-
1485
- if (promiseInput) {
1486
- return handlePromiseInput(promise, args, nodeFunc, this);
1487
- } else {
1488
- return handleValueInput(promise, args, nodeFunc, this);
1489
- }
1490
- };
1491
-
1492
- fn.__proto__ = nodeFunc;
1493
-
1494
- return fn;
1495
- }
1496
-
1497
- function handleValueInput(promise, args, nodeFunc, self) {
1498
- let result = tryCatch(nodeFunc).apply(self, args);
1499
- if (result === TRY_CATCH_ERROR) {
1500
- let error = TRY_CATCH_ERROR.error;
1501
- TRY_CATCH_ERROR.error = null;
1502
- reject(promise, error);
1503
- }
1504
- return promise;
1505
- }
1506
-
1507
- function handlePromiseInput(promise, args, nodeFunc, self){
1508
- return Promise.all(args)
1509
- .then(args => handleValueInput(promise, args, nodeFunc, self));
1510
- }
1511
-
1512
- function needsPromiseInput(arg) {
1513
- if (arg !== null && typeof arg === 'object') {
1514
- if (arg.constructor === Promise) {
1515
- return true;
1516
- } else {
1517
- return getThen(arg);
1518
- }
1519
- } else {
1520
- return false;
1521
- }
1522
- }
1523
-
1524
- /**
1525
- This is a convenient alias for `RSVP.Promise.all`.
1526
-
1527
- @method all
1528
- @static
1529
- @for RSVP
1530
- @param {Array} array Array of promises.
1531
- @param {String} label An optional label. This is useful
1532
- for tooling.
1533
- */
1534
- function all$1(array, label) {
1535
- return Promise.all(array, label);
1536
- }
1537
-
1538
- class AllSettled extends Enumerator {
1539
- constructor(Constructor, entries, label) {
1540
- super(Constructor, entries, false /* don't abort on reject */, label);
1541
- }
1542
- }
1543
-
1544
- AllSettled.prototype._setResultAt = setSettledResult;
1545
-
1546
- /**
1547
- `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
1548
- a fail-fast method, it waits until all the promises have returned and
1549
- shows you all the results. This is useful if you want to handle multiple
1550
- promises' failure states together as a set.
1551
-
1552
- Returns a promise that is fulfilled when all the given promises have been
1553
- settled. The return promise is fulfilled with an array of the states of
1554
- the promises passed into the `promises` array argument.
1555
-
1556
- Each state object will either indicate fulfillment or rejection, and
1557
- provide the corresponding value or reason. The states will take one of
1558
- the following formats:
1559
-
1560
- ```javascript
1561
- { state: 'fulfilled', value: value }
1562
- or
1563
- { state: 'rejected', reason: reason }
1564
- ```
1565
-
1566
- Example:
1567
-
1568
- ```javascript
1569
- let promise1 = RSVP.Promise.resolve(1);
1570
- let promise2 = RSVP.Promise.reject(new Error('2'));
1571
- let promise3 = RSVP.Promise.reject(new Error('3'));
1572
- let promises = [ promise1, promise2, promise3 ];
1573
-
1574
- RSVP.allSettled(promises).then(function(array){
1575
- // array == [
1576
- // { state: 'fulfilled', value: 1 },
1577
- // { state: 'rejected', reason: Error },
1578
- // { state: 'rejected', reason: Error }
1579
- // ]
1580
- // Note that for the second item, reason.message will be '2', and for the
1581
- // third item, reason.message will be '3'.
1582
- }, function(error) {
1583
- // Not run. (This block would only be called if allSettled had failed,
1584
- // for instance if passed an incorrect argument type.)
1585
- });
1586
- ```
1587
-
1588
- @method allSettled
1589
- @static
1590
- @for RSVP
1591
- @param {Array} entries
1592
- @param {String} label - optional string that describes the promise.
1593
- Useful for tooling.
1594
- @return {Promise} promise that is fulfilled with an array of the settled
1595
- states of the constituent promises.
1596
- */
1597
-
1598
- function allSettled(entries, label) {
1599
- if (!Array.isArray(entries)) {
1600
- return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);
1601
- }
1602
-
1603
- return new AllSettled(Promise, entries, label).promise;
1604
- }
1605
-
1606
- /**
1607
- This is a convenient alias for `RSVP.Promise.race`.
1608
-
1609
- @method race
1610
- @static
1611
- @for RSVP
1612
- @param {Array} array Array of promises.
1613
- @param {String} label An optional label. This is useful
1614
- for tooling.
1615
- */
1616
- function race$1(array, label) {
1617
- return Promise.race(array, label);
1618
- }
1619
-
1620
- class PromiseHash extends Enumerator {
1621
- constructor(Constructor, object, abortOnReject = true, label) {
1622
- super(Constructor, object, abortOnReject, label);
1623
- }
1624
-
1625
- _init(Constructor, object) {
1626
- this._result = {};
1627
- this._enumerate(object);
1628
- }
1629
-
1630
- _enumerate(input) {
1631
- let keys = Object.keys(input);
1632
-
1633
- let length = keys.length;
1634
- let promise = this.promise;
1635
- this._remaining = length;
1636
-
1637
- let key, val;
1638
- for (let i = 0; promise._state === PENDING && i < length; i++) {
1639
- key = keys[i];
1640
- val = input[key];
1641
- this._eachEntry(val, key, true);
1642
- }
1643
-
1644
- this._checkFullfillment();
1645
- }
1646
- }
1647
-
1648
- /**
1649
- `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array
1650
- for its `promises` argument.
1651
-
1652
- Returns a promise that is fulfilled when all the given promises have been
1653
- fulfilled, or rejected if any of them become rejected. The returned promise
1654
- is fulfilled with a hash that has the same key names as the `promises` object
1655
- argument. If any of the values in the object are not promises, they will
1656
- simply be copied over to the fulfilled object.
1657
-
1658
- Example:
1659
-
1660
- ```javascript
1661
- let promises = {
1662
- myPromise: RSVP.resolve(1),
1663
- yourPromise: RSVP.resolve(2),
1664
- theirPromise: RSVP.resolve(3),
1665
- notAPromise: 4
1666
- };
1667
-
1668
- RSVP.hash(promises).then(function(hash){
1669
- // hash here is an object that looks like:
1670
- // {
1671
- // myPromise: 1,
1672
- // yourPromise: 2,
1673
- // theirPromise: 3,
1674
- // notAPromise: 4
1675
- // }
1676
- });
1677
- ````
1678
-
1679
- If any of the `promises` given to `RSVP.hash` are rejected, the first promise
1680
- that is rejected will be given as the reason to the rejection handler.
1681
-
1682
- Example:
1683
-
1684
- ```javascript
1685
- let promises = {
1686
- myPromise: RSVP.resolve(1),
1687
- rejectedPromise: RSVP.reject(new Error('rejectedPromise')),
1688
- anotherRejectedPromise: RSVP.reject(new Error('anotherRejectedPromise')),
1689
- };
1690
-
1691
- RSVP.hash(promises).then(function(hash){
1692
- // Code here never runs because there are rejected promises!
1693
- }, function(reason) {
1694
- // reason.message === 'rejectedPromise'
1695
- });
1696
- ```
1697
-
1698
- An important note: `RSVP.hash` is intended for plain JavaScript objects that
1699
- are just a set of keys and values. `RSVP.hash` will NOT preserve prototype
1700
- chains.
1701
-
1702
- Example:
1703
-
1704
- ```javascript
1705
- function MyConstructor(){
1706
- this.example = RSVP.resolve('Example');
1707
- }
1708
-
1709
- MyConstructor.prototype = {
1710
- protoProperty: RSVP.resolve('Proto Property')
1711
- };
1712
-
1713
- let myObject = new MyConstructor();
1714
-
1715
- RSVP.hash(myObject).then(function(hash){
1716
- // protoProperty will not be present, instead you will just have an
1717
- // object that looks like:
1718
- // {
1719
- // example: 'Example'
1720
- // }
1721
- //
1722
- // hash.hasOwnProperty('protoProperty'); // false
1723
- // 'undefined' === typeof hash.protoProperty
1724
- });
1725
- ```
1726
-
1727
- @method hash
1728
- @static
1729
- @for RSVP
1730
- @param {Object} object
1731
- @param {String} label optional string that describes the promise.
1732
- Useful for tooling.
1733
- @return {Promise} promise that is fulfilled when all properties of `promises`
1734
- have been fulfilled, or rejected if any of them become rejected.
1735
- */
1736
- function hash(object, label) {
1737
- if (object === null || typeof object !== 'object') {
1738
- return Promise.reject(new TypeError("Promise.hash must be called with an object"), label);
1739
- }
1740
-
1741
- return new PromiseHash(Promise, object, label).promise;
1742
- }
1743
-
1744
- class HashSettled extends PromiseHash {
1745
- constructor(Constructor, object, label) {
1746
- super(Constructor, object, false, label);
1747
- }
1748
- }
1749
-
1750
- HashSettled.prototype._setResultAt = setSettledResult;
1751
-
1752
- /**
1753
- `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object
1754
- instead of an array for its `promises` argument.
1755
-
1756
- Unlike `RSVP.all` or `RSVP.hash`, which implement a fail-fast method,
1757
- but like `RSVP.allSettled`, `hashSettled` waits until all the
1758
- constituent promises have returned and then shows you all the results
1759
- with their states and values/reasons. This is useful if you want to
1760
- handle multiple promises' failure states together as a set.
1761
-
1762
- Returns a promise that is fulfilled when all the given promises have been
1763
- settled, or rejected if the passed parameters are invalid.
1764
-
1765
- The returned promise is fulfilled with a hash that has the same key names as
1766
- the `promises` object argument. If any of the values in the object are not
1767
- promises, they will be copied over to the fulfilled object and marked with state
1768
- 'fulfilled'.
1769
-
1770
- Example:
1771
-
1772
- ```javascript
1773
- let promises = {
1774
- myPromise: RSVP.Promise.resolve(1),
1775
- yourPromise: RSVP.Promise.resolve(2),
1776
- theirPromise: RSVP.Promise.resolve(3),
1777
- notAPromise: 4
1778
- };
1779
-
1780
- RSVP.hashSettled(promises).then(function(hash){
1781
- // hash here is an object that looks like:
1782
- // {
1783
- // myPromise: { state: 'fulfilled', value: 1 },
1784
- // yourPromise: { state: 'fulfilled', value: 2 },
1785
- // theirPromise: { state: 'fulfilled', value: 3 },
1786
- // notAPromise: { state: 'fulfilled', value: 4 }
1787
- // }
1788
- });
1789
- ```
1790
-
1791
- If any of the `promises` given to `RSVP.hash` are rejected, the state will
1792
- be set to 'rejected' and the reason for rejection provided.
1793
-
1794
- Example:
1795
-
1796
- ```javascript
1797
- let promises = {
1798
- myPromise: RSVP.Promise.resolve(1),
1799
- rejectedPromise: RSVP.Promise.reject(new Error('rejection')),
1800
- anotherRejectedPromise: RSVP.Promise.reject(new Error('more rejection')),
1801
- };
1802
-
1803
- RSVP.hashSettled(promises).then(function(hash){
1804
- // hash here is an object that looks like:
1805
- // {
1806
- // myPromise: { state: 'fulfilled', value: 1 },
1807
- // rejectedPromise: { state: 'rejected', reason: Error },
1808
- // anotherRejectedPromise: { state: 'rejected', reason: Error },
1809
- // }
1810
- // Note that for rejectedPromise, reason.message == 'rejection',
1811
- // and for anotherRejectedPromise, reason.message == 'more rejection'.
1812
- });
1813
- ```
1814
-
1815
- An important note: `RSVP.hashSettled` is intended for plain JavaScript objects that
1816
- are just a set of keys and values. `RSVP.hashSettled` will NOT preserve prototype
1817
- chains.
1818
-
1819
- Example:
1820
-
1821
- ```javascript
1822
- function MyConstructor(){
1823
- this.example = RSVP.Promise.resolve('Example');
1824
- }
1825
-
1826
- MyConstructor.prototype = {
1827
- protoProperty: RSVP.Promise.resolve('Proto Property')
1828
- };
1829
-
1830
- let myObject = new MyConstructor();
1831
-
1832
- RSVP.hashSettled(myObject).then(function(hash){
1833
- // protoProperty will not be present, instead you will just have an
1834
- // object that looks like:
1835
- // {
1836
- // example: { state: 'fulfilled', value: 'Example' }
1837
- // }
1838
- //
1839
- // hash.hasOwnProperty('protoProperty'); // false
1840
- // 'undefined' === typeof hash.protoProperty
1841
- });
1842
- ```
1843
-
1844
- @method hashSettled
1845
- @for RSVP
1846
- @param {Object} object
1847
- @param {String} label optional string that describes the promise.
1848
- Useful for tooling.
1849
- @return {Promise} promise that is fulfilled when when all properties of `promises`
1850
- have been settled.
1851
- @static
1852
- */
1853
-
1854
- function hashSettled(object, label) {
1855
- if (object === null || typeof object !== 'object') {
1856
- return Promise.reject(new TypeError("RSVP.hashSettled must be called with an object"), label);
1857
- }
1858
-
1859
- return new HashSettled(Promise, object, false, label).promise;
1860
- }
1861
-
1862
- /**
1863
- `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event
1864
- loop in order to aid debugging.
1865
-
1866
- Promises A+ specifies that any exceptions that occur with a promise must be
1867
- caught by the promises implementation and bubbled to the last handler. For
1868
- this reason, it is recommended that you always specify a second rejection
1869
- handler function to `then`. However, `RSVP.rethrow` will throw the exception
1870
- outside of the promise, so it bubbles up to your console if in the browser,
1871
- or domain/cause uncaught exception in Node. `rethrow` will also throw the
1872
- error again so the error can be handled by the promise per the spec.
1873
-
1874
- ```javascript
1875
- function throws(){
1876
- throw new Error('Whoops!');
1877
- }
1878
-
1879
- let promise = new RSVP.Promise(function(resolve, reject){
1880
- throws();
1881
- });
1882
-
1883
- promise.catch(RSVP.rethrow).then(function(){
1884
- // Code here doesn't run because the promise became rejected due to an
1885
- // error!
1886
- }, function (err){
1887
- // handle the error here
1888
- });
1889
- ```
1890
-
1891
- The 'Whoops' error will be thrown on the next turn of the event loop
1892
- and you can watch for it in your console. You can also handle it using a
1893
- rejection handler given to `.then` or `.catch` on the returned promise.
1894
-
1895
- @method rethrow
1896
- @static
1897
- @for RSVP
1898
- @param {Error} reason reason the promise became rejected.
1899
- @throws Error
1900
- @static
1901
- */
1902
- function rethrow(reason) {
1903
- setTimeout(() => {
1904
- throw reason;
1905
- });
1906
- throw reason;
1907
- }
1908
-
1909
- /**
1910
- `RSVP.defer` returns an object similar to jQuery's `$.Deferred`.
1911
- `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s
1912
- interface. New code should use the `RSVP.Promise` constructor instead.
1913
-
1914
- The object returned from `RSVP.defer` is a plain object with three properties:
1915
-
1916
- * promise - an `RSVP.Promise`.
1917
- * reject - a function that causes the `promise` property on this object to
1918
- become rejected
1919
- * resolve - a function that causes the `promise` property on this object to
1920
- become fulfilled.
1921
-
1922
- Example:
1923
-
1924
- ```javascript
1925
- let deferred = RSVP.defer();
1926
-
1927
- deferred.resolve("Success!");
1928
-
1929
- deferred.promise.then(function(value){
1930
- // value here is "Success!"
1931
- });
1932
- ```
1933
-
1934
- @method defer
1935
- @static
1936
- @for RSVP
1937
- @param {String} label optional string for labeling the promise.
1938
- Useful for tooling.
1939
- @return {Object}
1940
- */
1941
-
1942
- function defer(label) {
1943
- let deferred = { resolve: undefined, reject: undefined };
1944
-
1945
- deferred.promise = new Promise((resolve, reject) => {
1946
- deferred.resolve = resolve;
1947
- deferred.reject = reject;
1948
- }, label);
1949
-
1950
- return deferred;
1951
- }
1952
-
1953
- class MapEnumerator extends Enumerator {
1954
- constructor(Constructor, entries, mapFn, label) {
1955
- super(Constructor, entries, true, label, mapFn);
1956
- }
1957
-
1958
- _init(Constructor, input, bool, label, mapFn) {
1959
- let len = input.length || 0;
1960
- this.length = len;
1961
- this._remaining = len;
1962
- this._result = new Array(len);
1963
- this._mapFn = mapFn;
1964
-
1965
- this._enumerate(input);
1966
- }
1967
-
1968
- _setResultAt(state, i, value, firstPass) {
1969
- if (firstPass) {
1970
- let val = tryCatch(this._mapFn)(value, i);
1971
- if (val === TRY_CATCH_ERROR) {
1972
- this._settledAt(REJECTED, i, val.error, false);
1973
- } else {
1974
- this._eachEntry(val, i, false);
1975
- }
1976
- } else {
1977
- this._remaining--;
1978
- this._result[i] = value;
1979
- }
1980
- }
1981
-
1982
- }
1983
-
1984
-
1985
- /**
1986
- `RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called
1987
- meaning that as soon as any promise resolves its value will be passed to `mapFn`.
1988
- `RSVP.map` returns a promise that will become fulfilled with the result of running
1989
- `mapFn` on the values the promises become fulfilled with.
1990
-
1991
- For example:
1992
-
1993
- ```javascript
1994
-
1995
- let promise1 = RSVP.resolve(1);
1996
- let promise2 = RSVP.resolve(2);
1997
- let promise3 = RSVP.resolve(3);
1998
- let promises = [ promise1, promise2, promise3 ];
1999
-
2000
- let mapFn = function(item){
2001
- return item + 1;
2002
- };
2003
-
2004
- RSVP.map(promises, mapFn).then(function(result){
2005
- // result is [ 2, 3, 4 ]
2006
- });
2007
- ```
2008
-
2009
- If any of the `promises` given to `RSVP.map` are rejected, the first promise
2010
- that is rejected will be given as an argument to the returned promise's
2011
- rejection handler. For example:
2012
-
2013
- ```javascript
2014
- let promise1 = RSVP.resolve(1);
2015
- let promise2 = RSVP.reject(new Error('2'));
2016
- let promise3 = RSVP.reject(new Error('3'));
2017
- let promises = [ promise1, promise2, promise3 ];
2018
-
2019
- let mapFn = function(item){
2020
- return item + 1;
2021
- };
2022
-
2023
- RSVP.map(promises, mapFn).then(function(array){
2024
- // Code here never runs because there are rejected promises!
2025
- }, function(reason) {
2026
- // reason.message === '2'
2027
- });
2028
- ```
2029
-
2030
- `RSVP.map` will also wait if a promise is returned from `mapFn`. For example,
2031
- say you want to get all comments from a set of blog posts, but you need
2032
- the blog posts first because they contain a url to those comments.
2033
-
2034
- ```javscript
2035
-
2036
- let mapFn = function(blogPost){
2037
- // getComments does some ajax and returns an RSVP.Promise that is fulfilled
2038
- // with some comments data
2039
- return getComments(blogPost.comments_url);
2040
- };
2041
-
2042
- // getBlogPosts does some ajax and returns an RSVP.Promise that is fulfilled
2043
- // with some blog post data
2044
- RSVP.map(getBlogPosts(), mapFn).then(function(comments){
2045
- // comments is the result of asking the server for the comments
2046
- // of all blog posts returned from getBlogPosts()
2047
- });
2048
- ```
2049
-
2050
- @method map
2051
- @static
2052
- @for RSVP
2053
- @param {Array} promises
2054
- @param {Function} mapFn function to be called on each fulfilled promise.
2055
- @param {String} label optional string for labeling the promise.
2056
- Useful for tooling.
2057
- @return {Promise} promise that is fulfilled with the result of calling
2058
- `mapFn` on each fulfilled promise or value when they become fulfilled.
2059
- The promise will be rejected if any of the given `promises` become rejected.
2060
- @static
2061
- */
2062
- function map(promises, mapFn, label) {
2063
- if (!Array.isArray(promises)) {
2064
- return Promise.reject(new TypeError("RSVP.map must be called with an array"), label);
2065
- }
2066
-
2067
- if (typeof mapFn !== 'function') {
2068
- return Promise.reject(new TypeError("RSVP.map expects a function as a second argument"), label);
2069
- }
2070
-
2071
- return new MapEnumerator(Promise, promises, mapFn, label).promise;
2072
- }
2073
-
2074
- /**
2075
- This is a convenient alias for `RSVP.Promise.resolve`.
2076
-
2077
- @method resolve
2078
- @static
2079
- @for RSVP
2080
- @param {*} value value that the returned promise will be resolved with
2081
- @param {String} label optional string for identifying the returned promise.
2082
- Useful for tooling.
2083
- @return {Promise} a promise that will become fulfilled with the given
2084
- `value`
2085
- */
2086
- function resolve$2(value, label) {
2087
- return Promise.resolve(value, label);
2088
- }
2089
-
2090
- /**
2091
- This is a convenient alias for `RSVP.Promise.reject`.
2092
-
2093
- @method reject
2094
- @static
2095
- @for RSVP
2096
- @param {*} reason value that the returned promise will be rejected with.
2097
- @param {String} label optional string for identifying the returned promise.
2098
- Useful for tooling.
2099
- @return {Promise} a promise rejected with the given `reason`.
2100
- */
2101
- function reject$2(reason, label) {
2102
- return Promise.reject(reason, label);
2103
- }
2104
-
2105
- const EMPTY_OBJECT = {};
2106
-
2107
- class FilterEnumerator extends MapEnumerator {
2108
-
2109
- _checkFullfillment() {
2110
- if (this._remaining === 0 && this._result !== null) {
2111
- let result = this._result.filter((val) => val !== EMPTY_OBJECT);
2112
- fulfill(this.promise, result);
2113
- this._result = null;
2114
- }
2115
- }
2116
-
2117
- _setResultAt(state, i, value, firstPass) {
2118
- if (firstPass) {
2119
- this._result[i] = value;
2120
- let val = tryCatch(this._mapFn)(value, i);
2121
- if (val === TRY_CATCH_ERROR) {
2122
- this._settledAt(REJECTED, i, val.error, false);
2123
- } else {
2124
- this._eachEntry(val, i, false);
2125
- }
2126
- } else {
2127
- this._remaining--;
2128
- if (!value) {
2129
- this._result[i] = EMPTY_OBJECT;
2130
- }
2131
- }
2132
- }
2133
- }
2134
-
2135
- /**
2136
- `RSVP.filter` is similar to JavaScript's native `filter` method.
2137
- `filterFn` is eagerly called meaning that as soon as any promise
2138
- resolves its value will be passed to `filterFn`. `RSVP.filter` returns
2139
- a promise that will become fulfilled with the result of running
2140
- `filterFn` on the values the promises become fulfilled with.
2141
-
2142
- For example:
2143
-
2144
- ```javascript
2145
-
2146
- let promise1 = RSVP.resolve(1);
2147
- let promise2 = RSVP.resolve(2);
2148
- let promise3 = RSVP.resolve(3);
2149
-
2150
- let promises = [promise1, promise2, promise3];
2151
-
2152
- let filterFn = function(item){
2153
- return item > 1;
2154
- };
2155
-
2156
- RSVP.filter(promises, filterFn).then(function(result){
2157
- // result is [ 2, 3 ]
2158
- });
2159
- ```
2160
-
2161
- If any of the `promises` given to `RSVP.filter` are rejected, the first promise
2162
- that is rejected will be given as an argument to the returned promise's
2163
- rejection handler. For example:
2164
-
2165
- ```javascript
2166
- let promise1 = RSVP.resolve(1);
2167
- let promise2 = RSVP.reject(new Error('2'));
2168
- let promise3 = RSVP.reject(new Error('3'));
2169
- let promises = [ promise1, promise2, promise3 ];
2170
-
2171
- let filterFn = function(item){
2172
- return item > 1;
2173
- };
2174
-
2175
- RSVP.filter(promises, filterFn).then(function(array){
2176
- // Code here never runs because there are rejected promises!
2177
- }, function(reason) {
2178
- // reason.message === '2'
2179
- });
2180
- ```
2181
-
2182
- `RSVP.filter` will also wait for any promises returned from `filterFn`.
2183
- For instance, you may want to fetch a list of users then return a subset
2184
- of those users based on some asynchronous operation:
2185
-
2186
- ```javascript
2187
-
2188
- let alice = { name: 'alice' };
2189
- let bob = { name: 'bob' };
2190
- let users = [ alice, bob ];
2191
-
2192
- let promises = users.map(function(user){
2193
- return RSVP.resolve(user);
2194
- });
2195
-
2196
- let filterFn = function(user){
2197
- // Here, Alice has permissions to create a blog post, but Bob does not.
2198
- return getPrivilegesForUser(user).then(function(privs){
2199
- return privs.can_create_blog_post === true;
2200
- });
2201
- };
2202
- RSVP.filter(promises, filterFn).then(function(users){
2203
- // true, because the server told us only Alice can create a blog post.
2204
- users.length === 1;
2205
- // false, because Alice is the only user present in `users`
2206
- users[0] === bob;
2207
- });
2208
- ```
2209
-
2210
- @method filter
2211
- @static
2212
- @for RSVP
2213
- @param {Array} promises
2214
- @param {Function} filterFn - function to be called on each resolved value to
2215
- filter the final results.
2216
- @param {String} label optional string describing the promise. Useful for
2217
- tooling.
2218
- @return {Promise}
2219
- */
2220
-
2221
- function filter(promises, filterFn, label) {
2222
- if (typeof filterFn !== 'function') {
2223
- return Promise.reject(new TypeError("RSVP.filter expects function as a second argument"), label);
2224
- }
2225
-
2226
- return Promise.resolve(promises, label)
2227
- .then(function(promises) {
2228
- if (!Array.isArray(promises)) {
2229
- throw new TypeError("RSVP.filter must be called with an array");
2230
- }
2231
- return new FilterEnumerator(Promise, promises, filterFn, label).promise;
2232
- });
2233
- }
2234
-
2235
- let len = 0;
2236
- let vertxNext;
2237
- function asap(callback, arg) {
2238
- queue$1[len] = callback;
2239
- queue$1[len + 1] = arg;
2240
- len += 2;
2241
- if (len === 2) {
2242
- // If len is 1, that means that we need to schedule an async flush.
2243
- // If additional callbacks are queued before the queue is flushed, they
2244
- // will be processed by this flush that we are scheduling.
2245
- scheduleFlush$1();
2246
- }
2247
- }
2248
-
2249
- const browserWindow = (typeof window !== 'undefined') ? window : undefined;
2250
- const browserGlobal = browserWindow || {};
2251
- const BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
2252
- const isNode = typeof self === 'undefined' &&
2253
- typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
2254
-
2255
- // test for web worker but not in IE10
2256
- const isWorker = typeof Uint8ClampedArray !== 'undefined' &&
2257
- typeof importScripts !== 'undefined' &&
2258
- typeof MessageChannel !== 'undefined';
2259
-
2260
- // node
2261
- function useNextTick() {
2262
- let nextTick = process.nextTick;
2263
- // node version 0.10.x displays a deprecation warning when nextTick is used recursively
2264
- // setImmediate should be used instead instead
2265
- let version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
2266
- if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
2267
- nextTick = setImmediate;
2268
- }
2269
- return () => nextTick(flush);
2270
- }
2271
-
2272
- // vertx
2273
- function useVertxTimer() {
2274
- if (typeof vertxNext !== 'undefined') {
2275
- return function() {
2276
- vertxNext(flush);
2277
- };
2278
- }
2279
- return useSetTimeout();
2280
- }
2281
-
2282
- function useMutationObserver() {
2283
- let iterations = 0;
2284
- let observer = new BrowserMutationObserver(flush);
2285
- let node = document.createTextNode('');
2286
- observer.observe(node, { characterData: true });
2287
-
2288
- return () => node.data = (iterations = ++iterations % 2);
2289
- }
2290
-
2291
- // web worker
2292
- function useMessageChannel() {
2293
- let channel = new MessageChannel();
2294
- channel.port1.onmessage = flush;
2295
- return () => channel.port2.postMessage(0);
2296
- }
2297
-
2298
- function useSetTimeout() {
2299
- return () => setTimeout(flush, 1);
2300
- }
2301
-
2302
- const queue$1 = new Array(1000);
2303
-
2304
- function flush() {
2305
- for (let i = 0; i < len; i+=2) {
2306
- let callback = queue$1[i];
2307
- let arg = queue$1[i+1];
2308
-
2309
- callback(arg);
2310
-
2311
- queue$1[i] = undefined;
2312
- queue$1[i+1] = undefined;
2313
- }
2314
-
2315
- len = 0;
2316
- }
2317
-
2318
- function attemptVertex() {
2319
- try {
2320
- const vertx = Function('return this')().require('vertx');
2321
- vertxNext = vertx.runOnLoop || vertx.runOnContext;
2322
- return useVertxTimer();
2323
- } catch(e) {
2324
- return useSetTimeout();
2325
- }
2326
- }
2327
-
2328
- let scheduleFlush$1;
2329
- // Decide what async method to use to triggering processing of queued callbacks:
2330
- if (isNode) {
2331
- scheduleFlush$1 = useNextTick();
2332
- } else if (BrowserMutationObserver) {
2333
- scheduleFlush$1 = useMutationObserver();
2334
- } else if (isWorker) {
2335
- scheduleFlush$1 = useMessageChannel();
2336
- } else if (browserWindow === undefined && typeof require === 'function') {
2337
- scheduleFlush$1 = attemptVertex();
2338
- } else {
2339
- scheduleFlush$1 = useSetTimeout();
2340
- }
2341
-
2342
- // defaults
2343
- config.async = asap;
2344
- config.after = cb => setTimeout(cb, 0);
2345
- const cast = resolve$2;
2346
-
2347
- const async = (callback, arg) => config.async(callback, arg);
2348
-
2349
- function on() {
2350
- config.on(...arguments);
2351
- }
2352
-
2353
- function off() {
2354
- config.off(...arguments);
2355
- }
2356
-
2357
- // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
2358
- if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') {
2359
- let callbacks = window['__PROMISE_INSTRUMENTATION__'];
2360
- configure('instrument', true);
2361
- for (let eventName in callbacks) {
2362
- if (callbacks.hasOwnProperty(eventName)) {
2363
- on(eventName, callbacks[eventName]);
2364
- }
2365
- }
2366
- }
2367
-
2368
- // the default export here is for backwards compat:
2369
- // https://github.com/tildeio/rsvp.js/issues/434
2370
- var rsvp = {
2371
- asap,
2372
- cast,
2373
- Promise,
2374
- EventTarget,
2375
- all: all$1,
2376
- allSettled,
2377
- race: race$1,
2378
- hash,
2379
- hashSettled,
2380
- rethrow,
2381
- defer,
2382
- denodeify,
2383
- configure,
2384
- on,
2385
- off,
2386
- resolve: resolve$2,
2387
- reject: reject$2,
2388
- map,
2389
- async,
2390
- filter
2391
- };
2392
-
2393
- export default rsvp;
2394
- export { asap, cast, Promise, EventTarget, all$1 as all, allSettled, race$1 as race, hash, hashSettled, rethrow, defer, denodeify, configure, on, off, resolve$2 as resolve, reject$2 as reject, map, async, filter };