
Javascript
yuxuac
这个作者很懒,什么都没留下…
展开
-
Javascript - JSON.stringify - Circular Structure
let cache = []; let result = JSON.stringify(pool.pool, (key, value) => { if (typeof value === 'object' && value !== null) { // Duplicate reference found, discard key if (cache.includes(value)) return; ...转载 2020-06-09 11:58:48 · 484 阅读 · 0 评论 -
Javascript - NodeJS - Convert buffer to stream
The most effective way:const stream = require('stream');// The bufferlet buffer = Buffer.from("Hello world!", "utf-8");// The stream from bufferlet bufferStream = new stream.PassThrough();buff...原创 2020-03-31 11:32:11 · 628 阅读 · 0 评论 -
Javascript - Consuming Readable Streams with Async Iterators
// https://nodejs.org/api/stream.html#stream_class_stream_passthrough// search: Consuming Readable Streams with Async Iterators(async function () { for await (const chunk of file.stream()) { ...转载 2020-03-30 10:44:49 · 214 阅读 · 0 评论 -
Javascript - async await
// 1. async functions always return a Promise// 2. await will return resolved data of a promise, it can be a 'data or an 'error'.// An async function: getDataPromise()const getDataPromise = (num)...原创 2020-03-23 08:30:40 · 204 阅读 · 0 评论 -
Javascript - Callback, Promise and Promise Chaining
// 1. Use callback in an async function, call the callback when necessary during the async call.const getValueFunc1 = (key, callback) => { setTimeout(() => { callback(null, "Data f...转载 2020-03-23 07:39:46 · 189 阅读 · 0 评论 -
Javascript - var function scope.
varvariables are ‘function scope.’ What does this mean? It means they are only availableinsidethe function they’re created in, or if not created inside a function, they are ‘globally scoped.’var...原创 2020-03-08 20:50:37 · 235 阅读 · 0 评论 -
Some urls - Web relating
FLUX:http://facebook.github.io/flux/docs/overview.htmlhttps://www.toptal.com/front-end/simple-data-flow-in-react-applications-using-flux-and-backboneUI:https://github.com/callemall/mat原创 2016-09-23 18:14:21 · 389 阅读 · 0 评论 -
.Net ReactJS 资源
Baidu CDN:http://developer.baidu.com/wiki/index.php?title=docs/cplat/libsReactJS:http://facebook.github.io/react/原创 2016-06-07 13:28:17 · 653 阅读 · 0 评论 -
ReactJS - Components之间的传值问题
1. 子控件向父控件传值:a. 在父控件定义接收函数 handleItem(item);b. 在子控件定义props: customHandleItem;c. 父控件Render()中,将子空间的属性:customHandleItem设置为父控件的接收函数: handleItem;d. 在子控件需要将值传递出来的位置调用:this.props.customHandleItem(it原创 2016-09-10 22:09:18 · 1798 阅读 · 0 评论 -
Javascript - 两个MutipleSelect控件
http://davidstutz.github.io/bootstrap-multiselect/#methodshttp://wenzhixin.net.cn/p/multiple-select/docs/index.html?locale=zh_CN#the-multiple-items转载 2017-12-07 15:22:59 · 331 阅读 · 0 评论 -
Javascript falsy values
The falsy values are:false, null, undefined, 0, -0, NaN, and "".All other values, including all objects, are truthy-From JavaScript: The Definitive Guide原创 2019-08-09 14:46:22 · 201 阅读 · 0 评论 -
Javascript frameworks
1. Babel JS:Convert new version js to lower version js.2. ESLint: Js 语法检查。3. PWA Vue: A Progressive Web Application (PWA) is a web application that offers an app-like user experience on the web. Mod...原创 2019-08-20 18:01:51 · 537 阅读 · 0 评论 -
Javascript - Object Utility
/** Copy the enumerable properties of p to o, and return o.* If o and p have a property by the same name, o's property is overwritten.* This function does not handle getters and setters or copy at...转载 2019-09-03 23:51:59 · 362 阅读 · 0 评论 -
Javascript - 方法注入 Method Injection 'monkey-patching'
读Javascript: The Definitive Guide这本书的时候发现一个有意思的代码,可以在调用方法的之前和之后注入一些回调或者代码,分享给大家:// Define a method.function addBy10(val) { return val + 10;}var obj = { 'myMethod': addBy10 };obj.myMethod(5)...转载 2019-10-02 21:29:26 · 266 阅读 · 0 评论 -
Javascript - 继承 Inheritance
继承关系/* Java: 1. Instance fields 2. Instance methods 3. Class fields 4. Class methods Javascript: 1. Constructor object => class methods and class fields 2. ...原创 2019-10-04 22:40:55 · 164 阅读 · 0 评论 -
Javascript - A Set class
// 9.6.1 A Set Class function Set() { this.values = {}; this.n = 0; this.add.apply(this, arguments); } Set.prototype.add = function() { for(var i = 0 ...转载 2019-10-05 11:30:44 · 194 阅读 · 0 评论 -
ASP.NET MVC - 使用Ajax更新局部视图
https://cmatskas.com/update-an-mvc-partial-view-with-ajax/转载 2016-04-21 09:36:32 · 2915 阅读 · 0 评论 -
用到的Javscript插件
1. 显示提示信息:qTip2 is the second generation of the advanced qTip plugin for the ever popular jQuery framework.Building on 1.0's user friendly, yet feature rich base, qTip2 provides you with tonnes of f原创 2016-05-02 21:26:39 · 5582 阅读 · 0 评论 -
Jquery - JSON / JSON string
JSON 字符串定义.原创 2015-08-01 18:06:15 · 427 阅读 · 0 评论 -
Javascript - StringBuilder
var html = []; html.push( "", "", "bla bla bla", "", "" ); return html.join("");http://stackoverflow.com/questions/2087522/does-javascript-have-a-built-in-stringbuilder-cla转载 2015-08-13 23:31:04 · 572 阅读 · 0 评论 -
jQuery - 自定义li元素的FocusColor
自定义一个Li的函数,如果鼠标移动到此元素上,则改变其背景颜色。 自定义一个jquery插件 li{ list-style-type:none; } AAA原创 2015-08-03 23:54:50 · 1791 阅读 · 0 评论 -
JavaScript 学习笔记 2015-09-17
//严格模式定义 "-use strict"; // 变量定义 /* var a; var c = a + 2; var array = []; var n = null; console.log(n + 1); console.log(c); console.log(array ); console.log(ar原创 2015-09-17 23:27:48 · 352 阅读 · 0 评论 -
Javascript - Function access scope analysis 函数在页面上的可访问性浅析
Pure Javascript test - Function Access Scope. <!-- As we know, people can define javascript block in 3 places, the Head block, the Body block and after the Body block. When you define a func原创 2015-09-20 21:00:04 · 530 阅读 · 0 评论 -
Javascript code standard.
https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/转载 2015-10-29 11:28:57 · 390 阅读 · 0 评论 -
Javascript - 定义函数直接调用
// 定义函数直接调用 (function () { var userID = @Model.UserId ?? 0; var apiURI = '../../Claim/GetCurrentUserWorkStatus' var inputData = { id : userID }; if(userID > 0){原创 2015-11-27 09:05:41 · 479 阅读 · 0 评论 -
NodeJS - fs
/* 1. Create a file 2. Write some data, 5000 lines 3. Rename it 4. Move it to a non-existing sub folder. 5. Read whole file and print 6. Read file by stream and print each chunk's content and si原创 2016-01-23 16:54:27 · 566 阅读 · 0 评论 -
Jquery - ajax url路径问题
使用Ajax时,url路径可以为相对路径或者绝对路径。如果我们引用一个url为相对路径:./YourAPI/Action,则此路径会与我们访问的url相关。假设当前请求的URL为http://localhost:8080/YourAPI/, 则此ajax中的url为:http://localhost:8080/YourAPI/Action。但如果当前请求的URL为http://原创 2016-04-26 09:59:27 · 39247 阅读 · 0 评论 -
Jquery - Javascript 基本问题汇总
http://stackoverflow.com/questions/111102/how-do-javascript-closures-work转载 2016-04-26 09:19:24 · 531 阅读 · 0 评论 -
Chrome 调试动态Javascript
我们在开发Web应用的时候,会遇到动态加载Javascript的情况,动态加载的JS文件我们没办法直接调试。要解决此问题,我们需要在需要动态加载的JS文件头部添加以下注释://# sourceURL=可任意取名.js请注意#之后的空格。在(no domain)下,我们即可看到此文件:原创 2016-04-26 11:18:37 · 766 阅读 · 0 评论 -
Javascript 变量作用域 缩写词 及两种定义的区别
http://www.cnblogs.com/rainman/archive/2009/04/28/1445687.html转载 2016-04-15 11:52:08 · 371 阅读 · 0 评论 -
Javascript - 数组详解
// 数组详解http://www.cnblogs.com/dolphinX/p/3353590.html转载 2016-04-15 14:29:07 · 303 阅读 · 0 评论 -
JQuery API Reference
-- 原文https://oscarotero.com/jquery/--中文版http://www.css88.com/jqapi-1.9/转载 2016-04-16 18:23:47 · 456 阅读 · 0 评论 -
常用Javascript框架总结
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions,views with declarative event han原创 2016-05-02 01:36:12 · 428 阅读 · 0 评论 -
javascript - 得到鼠标点击的相对位置
假设我们有一个button:Click me怎么能得到鼠标点击的位置? function OnMouseClick(event) { var x = window.event.x - event.offsetLeft var y = window.event.y - event.offsetTop; alert('x/y:'原创 2013-10-18 15:31:27 · 676 阅读 · 0 评论