Ember-weak-ref
THIS PROJECT IS CURRENTLY EXPERIMENTAL. PLEASE SUBMIT FEEDBACK.
WeakRef implementation for ember objects. Allowing a mixture of long-running and short running tasks to exist, without strongly retaining all parties.
Installation
ember install ember-weak-ref
Examples
note: with real ES6 proxies, the api becomes nicer
basic example
; const Foo = EmberObject; let foo = Foo; const weak = foo; ;
more advanced example
It is common, to want to create a weak reference to this
, unfortunately this
requires a second scope. To make this easier, obj.weak(fn)
yields the WeakReference as its argument.
note: be sure not to close over anything you don't want to retain (other weak refs are ok)