简体   繁体   中英

What is the difference between Mustache.render() and Mustache.to_html()?

The documentation makes no mention of Mustache.to_html(), but every tutorial for Mustache.js online uses Mustache.to_html(). Therefore I am surely missing some jewels.

Code examples would be very much appreciated.

Looking at the source , it seems has essentially been deprecated: 基本上已被弃用:

// This is here for backwards compatibility with 0.4.x.
exports.to_html = function (template, view, partials, send) {
    var result = render(template, view, partials);

    if (typeof send === "function") {
      send(result);
    } else {
      return result;
    }
};

As you can see it invokes render . The one difference is the extra (optional) send parameter, which is a callback it invokes (sending the result as a parameter).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM