Comments (4)
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.
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.
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:
- There are already lots of dependencies, 14 in total including underscore. Removing underscore won't make the situation much better(still 13 dependencies remaining).
- 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.
No problem.
from markdown-plus.
Related Issues (20)
- 执行安装失败 HOT 1
- Flow chart arrows huge in windows version
- 请问怎么把代码弄成index.bundle.js,yarn watch时报这个错
- MDP Registered Last Versión Failed to Save As
- Include license as a file
- A vulnerablity on the website
- Online real-time collaborative edition?
- windows 10上没法用
- XSS via Markdown
- [[a,b],[c,d]] is not rendered
- Paginated PDF import contains only empty pages HOT 3
- 询问授权问题 HOT 1
- Visual code extension
- IE浏览器不可以使用预览功能吗?
- '\tag{num}' is not work
- Windows MDP 2.3.0: Window Maximized Improperly
- Windows MDP 2.3.0: Missing Exit Menu and Minimize to Systray option
- Commonmark conformance
- Standalone rendering engine
- flowchart arrows missing when export to html
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown-plus.