jashkenas / backbone

Give your JS App some Backbone with Models, Views, Collections, and Events
http://backbonejs.org
MIT License
28.09k stars 5.39k forks source link

live data in dashboard update backbone application #4223

Closed midhunkpaul closed 4 years ago

midhunkpaul commented 4 years ago

in my project we have a live data updation for this we are using backbone js push notification. when am using pusher am getting an error like backbone pusher is undefined how to solve this problem or is there any alternative for this live data updation

this is the source code for collection,

define(['backbone', 'app/models/TestModel', 'BackbonePusher'], function (Backbone, TestModel, BackbonePusher) { return Backbone.Collection.extend({ model: TestModel,

    initialize: function () {

        _.extend(this, BackbonePusher.prototype);

        if (_.isFunction(this.initialize)) {
            this.initialize({
                key: 'pusher-key',
                channel: 'yourApp',
                channelSuffix: 'channel',
                messageSuffix: 'message',
                autoListen: true,
                logEvents: true,
                logStats: true,
                filters: {
                    status: 'archived'
                }
            });
        }

        return this;
    }
});

});

paulfalgout commented 4 years ago

I don't think this is a question for this repo. At least it is related to BackbonePusher though I am unaware of that library. But if it's undefined it seems like there's something in your amd / build that isn't loading a dependency. In any case, I don't think this is related to backbone.js

midhunkpaul commented 4 years ago

@paulfalgout Any other way to update data in dashboard without refresh the page in Backbone.

paulfalgout commented 4 years ago

One of the main functions of backbone is rendering data to views after a page is loaded with ability to re-view.render() with new data without page refresh. In general you do not need to refresh the page in backbone. but how you get that data will vary. Here's an example of an app re-rendering views without needing to refresh the page: http://jsfiddle.net/joeartsea/KjYqf/

midhunkpaul commented 4 years ago

@paulfalgout some how its working, but my requirement is we are open the project in two browsers or system. and we are updating some data in one system or browser that will instantly update to the another browser or system without refresh the whole page.

is there any library file that is equivalent to signal R.