Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
web-page.js 647 B
Newer Older
  • Learn to ignore specific revisions
  • peter_rabbit's avatar
    peter_rabbit committed
    "use strict";
    
    Pierre Jarriges's avatar
    Pierre Jarriges committed
    const translator = require("ks-cheap-translator");
    const { translations_url } = require("../../constants");
    
    peter_rabbit's avatar
    peter_rabbit committed
    
    class WebPage {
        constructor(args) {
            Object.assign(this, args);
    
    Pierre Jarriges's avatar
    Pierre Jarriges committed
    
            if (!this.id) {
                this.id = "webpage-" + performance.now();
            }
    
            translator.init({
                translations_url,
                supported_languages: ["fr", "en"],
            }).then(this.refresh_all.bind(this));
        }
    
        refresh() {
            obj2htm.subRender(this.render(), document.getElementById(this.id), { mode: "replace" })
        }
    
        refresh_all() {
            obj2htm.renderCycle()
    
    peter_rabbit's avatar
    peter_rabbit committed
        }
    }
    
    module.exports = WebPage;