I am extending an application that works using Spine.Model.Local in order to support google drive realtime docs.
I have completed the code that takes care of this process. Now I want to add it on any Model using a process same as @extend Spine.Model.Local.
The code I need to have only listens for events, and is not actually extending any existing Model methods. It looks like this:
Spine.Model.Realtime =
@bind('update',rtc.saveJSON)
@bind('destroy',rtc.deleteJSON) //< SyntaxError: Coffeescript Error: unexpected TERMINATOR when I dont intend on same level with Spine.mode.realtime
Spine.bind("Model:fileUpdate",(event) -> modelMapUpdate(event))
Spine.bind('Model:fileLoad',(map) -> loadModelMap(map))
Then I have defined two functions as well as an external JS file (rtc).
My problem is how I can add this to any Model class I need using the @extend, or something similar?
p.s I tried placing Spine.Mode.Realtime in node_modules/spine/src/ but it did not work. I am getting Uncaught Error: extend(obj) requires obj.
Also I keep getting this error : SyntaxError: Coffeescript Error: unexpected TERMINATOR
p.s II: The above code works fine when its part of a Model class. I just need to take it out so that its reusable.