Sha256: eebf244b005cb6b0a5827a2b078b062788cb950a58a5f1efe0af032e47090e38

Contents?: true

Size: 1 KB

Versions: 57

Compression:

Stored size: 1 KB

Contents

define(function(require, exports, module) {
"use strict";

var Document = require("../document").Document;
var lang = require("../lib/lang");
    
var Mirror = exports.Mirror = function(sender) {
    this.sender = sender;
    var doc = this.doc = new Document("");
    
    var deferredUpdate = this.deferredUpdate = lang.deferredCall(this.onUpdate.bind(this));
    
    var _self = this;
    sender.on("change", function(e) {
        doc.applyDeltas([e.data]);        
        deferredUpdate.schedule(_self.$timeout);
    });
};

(function() {
    
    this.$timeout = 500;
    
    this.setTimeout = function(timeout) {
        this.$timeout = timeout;
    };
    
    this.setValue = function(value) {
        this.doc.setValue(value);
        this.deferredUpdate.schedule(this.$timeout);
    };
    
    this.getValue = function(callbackId) {
        this.sender.callback(this.doc.getValue(), callbackId);
    };
    
    this.onUpdate = function() {
        // abstract method
    };
    
}).call(Mirror.prototype);

});

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
gollum-3.1.2 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-3.1.1 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-3.1.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-3.0.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.7.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.6.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.5.2 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.5.1 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.5.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.15 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.14 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.13 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.12 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.11 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.10 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.9 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.8 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.7 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.6 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-2.4.5 lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js