Skip to content

Instantly share code, notes, and snippets.

@costa
Created February 4, 2015 20:52
Show Gist options
  • Select an option

  • Save costa/43ddf9ae5c51791aeab6 to your computer and use it in GitHub Desktop.

Select an option

Save costa/43ddf9ae5c51791aeab6 to your computer and use it in GitHub Desktop.
MockFirebase persistence shim; to be used with e.g. `window.MOCK_FIREBASE = #{{"null/things/#{id}" => firebase_val}.to_json};`
#= require mockfirebase/browser/mockfirebase
MockFirebase.override()
class TrueMockFirebase extends Firebase
constructor: (path)->
super
_(=>
if window.MOCK_FIREBASE && MOCK_FIREBASE[path]
@set(MOCK_FIREBASE[path])
MOCK_FIREBASE[path] = null
@flush()
).delay 999
window.Firebase = TrueMockFirebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment