Sha256: 6a3ee2502273a6e13e9d673e1cf0fa3401086abfd60667354966c9abbb4723e9

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 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.delayedCall(this.onUpdate.bind(this));
    
    var _self = this;
    sender.on("change", function(e) {
        doc.applyDeltas(e.data);
        if (_self.$timeout)
            return deferredUpdate.schedule(_self.$timeout);
        _self.onUpdate();
    });
};

(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
    };
    
    this.isPending = function() {
        return this.deferredUpdate.isPending();
    };
    
}).call(Mirror.prototype);

});

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
gollum-4.1.4 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-4.1.3 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
inc_gollum-4.1.2d lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
inc_gollum-4.1.2c lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-4.1.2 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-4.1.1 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-4.1.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-4.0.1 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
pollypost-0.0.2 vendor/assets/ace-1.1.8/worker/mirror.js
gollum-4.0.0 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
gollum-3.1.3 lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js