Giter VIP home page Giter VIP logo

Comments (4)

tylerlong avatar tylerlong commented on August 20, 2024

Thank you for the code!

I have a question for you: why do you want to replace underscore debounce with plain JS?

I think it could make the dependent libraries size smaller, but it also increases the length of our code.

I prefer to make our code as short as possible. Actually it is the #1 of the features list in readme file:

Simple, only a few handred lines of code

I am very open-minded, if you have good reasons I am willing to use your code.

Best Regards,

from markdown-plus.

codelinter avatar codelinter commented on August 20, 2024

You are right, it will make dependencies lighter. No need to download that extra 16KB. Because other people also download lot of other libraries and it could become very big eventually.

If code management is the problem then, putting that debounce func in its own file we make it cleaner. And then update index.html head tag. And last, instead of _.debounce(), just use debounce()

 <head>
    <meta charset="utf-8">
    <title>Markdown Plus</title>
    <link rel="stylesheet" href="bower_components/jquery-ui-layout-min/layout-default.css"/>
    <link rel="stylesheet" href="bower_components/github-markdown-css/github-markdown.css"/>
    <link rel="stylesheet" href="bower_components/prettify-min/prettify.min.css"/>
    <link rel="stylesheet" href="bower_components/font-awesome-min/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="bower_components/remodal-min/jquery.remodal.css"/>
    <link rel="stylesheet" href="bower_components/katex-build/katex.min.css"/>
    <link rel="stylesheet" href="bower_components/ionicons-min/css/ionicons.min.css"/>
    <link rel="stylesheet" href="markdown-plus.css"/>
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="bower_components/jquery-ui/jquery-ui.min.js"></script>
    <script src="bower_components/jquery-ui-layout-min/jquery.layout.min.js"></script>
    <script src="bower_components/ace-min-noconflict/ace.js" charset="utf-8"></script>
    <script src="bower_components/marked/marked.min.js"></script>
    <script src="bower_components/prettify-min/prettify.min.js"></script>
    <script src="bower_components/remodal-min/jquery.remodal.min.js"></script>
    <script src="bower_components/katex-build/katex.min.js"></script>
    <script src="bower_components/mermaid/dist/mermaid.full.min.js"></script>
    <script src="debounce.js"></script>
    <script src="markdown-plus.js""></script>
  </head>

This is "debounce.js"

//http://davidwalsh.name/javascript-debounce-function
function debounce(func, wait, immediate) {
    var timeout;
    return function() {
        var context = this, args = arguments;
        var later = function() {
            timeout = null;
            if (!immediate) func.apply(context, args);
        };
        var callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) func.apply(context, args);
    };
};

from markdown-plus.

tylerlong avatar tylerlong commented on August 20, 2024

Thank you for the detailed explanation and I really appreciate. What you said does make sense 👍 . But after thinking about it I decide to still use underscore. I hope that my decision doesn't make you feel bad. Here are my concerns:

  1. There are already lots of dependencies, 14 in total including underscore. Removing underscore won't make the situation much better(still 13 dependencies remaining).
  2. The project is open source and every one is free to change its code. So nothing stops the user to use a CDN service, such as:
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

Anyway, thank you for creating this issue! Let's work together to make the open source world better and better! 😄

from markdown-plus.

codelinter avatar codelinter commented on August 20, 2024

No problem.

from markdown-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.