惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

博客园 - 醒着/☆☆

移动硬盘删除不了东西 updata(dt:number)的常用用法 关键字 堆栈实现四则混合运算 在线资源 JS相比TS的缺点(或TS的优点) Vscode的JS debug环境 Cocos Creator-TypeScript与JS快速过渡 GooglePlay FB相关 上传速度慢 CocosCreator与Laya2.0区别 LayaBox 常用技巧 CSV的规范与使用 Laya2.0的转变 Laya for H5 之Bug追踪 TypeScript: this bind 和 回调的正确用法 常用资源 意外发现一个具有名称 的外部可见定义
常见的代码片段
醒着/☆☆ · 2019-10-30 · via 博客园 - 醒着/☆☆

TypeScipt的用户代码片段

{
	"create class":{
		"prefix": "crtc",
		"body": [
			"/** Created by Naiking.",
			" *  $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
			" *  ",
			" */",
			"//Learn TS:https://docs.cocos.com/creator/manual/zh/scripting/typescript.html",
			"//Learn Attribute:https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html",
			"//Life-cycle:https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html",
			"const {ccclass, property} = cc._decorator;",
			"@ccclass",
			"export default class $TM_FILENAME_BASE extends cc.Component {",
			"\t//@property(cc.Label)",
			"\t//label: cc.Label = null;",
			"\t//onLoad(){}",
			"\tstart(){",
			"\t\t",
			"\t}",
			"\tupdate(dt){}",
			"}"]
	},
}

提供一套较常见的“用户代码片段”
“文件”--“首选项”--“用户代码片段”--选择一个你需要设置的开发语言
本例是以javascript为例。(typesciprt的也同样的定义关键字)

其实这个文件,已经提供的一个最基础的示例了。
我的自定义添加了:创建文件块,加入作者,创建时间,设置光标,缩进符号

{
	// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"import namespace":{
		"prefix": "import",
		"body": "let $1=require('$1');",
		"description": "import"
	},
	"create class":{
		"prefix": "crtc",
		"body": [
			"/** Created by Naiking.",
			" *  $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
			" *  ",
			" */",
			"var $TM_FILENAME_BASE = cc.Class({",
			"// extends: cc.Component,",
			"\tname: '$TM_FILENAME_BASE',",
			"\tproperties: {",
			"\t\t$1",
			"\t},",
			"\tctor: function () {",
			"\t\t//this.xxx=arguments[0];",
			"\t}",
			"});",
			"module.exports =$TM_FILENAME_BASE;"]
	},
	"signal instance":{
		"prefix": "signal",
		"body": [
		"_instance:null,",
        "getInstance:function(){",
            "\tif(!$TM_FILENAME_BASE._instance)",
            "\t{",
                "\t\t$TM_FILENAME_BASE._instance=new $TM_FILENAME_BASE();",
            "\t}",
            "\treturn $TM_FILENAME_BASE._instance;",
        "}"
		]
	},
	"add new event type":{
		"prefix": "evttype",
		"body": "$1:'$1'"
	}
}

更详细的请参阅:
https://blog.csdn.net/maokelong95/article/details/54379046