The definition of class in ts

① class defined in ts: class Person{ name:string; //public keyword omitted before attribute constructor(n:string){ //Method triggered when the constructor instantiates the class this.name=n; } run():void{ alert(this.name); } } var p=new Person('Zhang San'); p.run() (2) implementation ...

Posted on Tue, 19 Nov 2019 09:16:52 -0500 by tunage

Dojo Style Introduction

Translation: https://github.com/dojo/framework/blob/master/docs/en/styling/introduction.md introduce Dojo is an HTML based technology that uses CSS to style elements in the framework and applications it develops. Dojo encourages encapsulation of structural styles in parts to maximize reuse, while setting theme to all parts of the application. W ...

Posted on Tue, 19 Nov 2019 04:05:48 -0500 by keldorn

javascript simulates various data structures

Recently, learning about data structures, based on the heart standard of ES6, we have written some custom structure classes (there are also Typescript version links after this article): 1. Stack class Stack { constructor() { this.count = 0; this.items = {}; } push(element) { this.items[this.count] = element; this.count++; ...

Posted on Mon, 11 Nov 2019 22:08:57 -0500 by SCRUBBIE1

JS implementation of Class inheritance in TypeScript

Create a new index.ts file to implement SubType inheriting SuperType. //index.ts class SuperType { name: String; constructor(name:String){ this.name = name; } getName():String{ return this.name } } class SubType extends SuperType { constructor(name:String){ super(name); } } Compile index.ts to ...

Posted on Sun, 10 Nov 2019 07:18:46 -0500 by Phpdiot

Developing NPM module based on TypeScript

Initialize NPM project mkdir project-name cd project-name npm init Add development base package Add TypeScript yarn add typescript -D Add Jest test tool yarn add jest ts-jest @types/jest -D Add @ types/node yarn add @types/node -D Initialize TypeScript configuration ./node_modules/.bin/tsc --init This will create a new tsconfig.json file in you ...

Posted on Sun, 03 Nov 2019 02:07:31 -0500 by cbcampbell

Disclosure of VSCode Technology

Preface Visual Studio Code (hereinafter referred to as VSCode) is a lightweight and powerful cross platform open source code editor (IDE). VSCode uses Electron. The code editor used is named Monaco. Monaco is also the code editor used by Visual Studio Team Service (Visual Studio Online). In terms of l ...

Posted on Sun, 27 Oct 2019 06:44:33 -0400 by gmbot

When you use "linkage" / "menu" and other components, the "array" you must use changes to "tree".

The new background makes the menu, and the backend says, "this time, the menu level is not fixed, and the table data (array) in the database will be sent to you directly." In fact, I seldom write data processing, but when I feel that I can almost achieve it, I agree. When I'm finished, I think it's still good to use. I'll share it wit ...

Posted on Wed, 23 Oct 2019 06:20:11 -0400 by richardw

[focus on nothing] Vue TS daily

This is a very interesting project. Let's see the effect first. The technology used in this project is also interesting. Its technology stack is vue2.5 + typescript + vuex + Vue router Put down the blogger's project address, https://github.com/xiaomuzhu/vue-ts-daily Next, let's look at the project code and study how to use ts in vue. First, the ...

Posted on Tue, 15 Oct 2019 12:21:31 -0400 by morbidchick

Cocos Creator 3D Bullet Launching and Camera Smooth Moving

> Online Experience Links: http://example.creator-star.cn/block3d/ In the previous article, we talked about the scene layout, material resources, physical rigid body and collision components of the 3D objects in the game of "Brick Playing". Next, this article focuses on "bullet launching" and "camera moving". W ...

Posted on Sun, 13 Oct 2019 22:53:31 -0400 by Liodel

void in JavaScript and TypeScript

Original address: https://fettblog.eu/void-in-j...Original title: void in JavaScript and TypeScript This article was first published on the Public Number: CoyPan in line with expectations If you move from traditional strongly typed languages to JavaScript, you may be familiar with the concept of void: a type that tells you that functions and m ...

Posted on Thu, 10 Oct 2019 08:57:23 -0400 by scott56hannah