本文整理汇总了TypeScript中es6-symbol.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: block
var Symbol = require('es6-symbol');
import {InSystemProgramming} from './InSystemProgramming';
import * as Utilities from './Utilities';
import {MemoryBlock} from './MemoryBlock';
import {RAMAddress} from './RAMAddress';
import {ROMBlock} from './ROMBlock';
const _blockSym = Symbol();
export class ROMWriter implements MemoryBlock {
set block(block: ROMBlock) { this[_blockSym] = block; }
get block(): ROMBlock { return this[_blockSym]; }
get address(): number { return this.block.address; }
get sector(): number { return this.block.sector; }
get length(): number { return this.block.length; }
constructor(private isp: InSystemProgramming, addr?: number, size?: number) {
if ((addr !== void 0) && size) {
this[_blockSym] = ROMBlock.fromAddress(addr, size);
}
}
eraseBlock(): Promise<ROMWriter> {
const endSect = Utilities.addressToSector(this.address + this.length - 1);
return this.isp.unlock()
.then(() => this.isp.sendCommand(`P ${this.sector} ${endSect}`))
.then(() => this.isp.sendCommand(`E ${this.sector} ${endSect}`))
.then(() => this);
开发者ID:sergezloto,项目名称:flashmagic.js,代码行数:31,代码来源:ROMWriter.ts
示例2: checksum
var Symbol = require('es6-symbol');
const _checksumSym = Symbol();
export class UUEncoder {
constructor() {
this[_checksumSym] = 0;
}
get checksum(): number {
return this[_checksumSym];
}
reset(): void {
this[_checksumSym] = 0;
}
encode(data: Buffer | Uint8Array, offset: number, length: number): string {
let out = encodeSingle(length);
let sum = 0;
const n = ~~(length / 3) * 3;
const m = n + offset;
let i = offset;
while (i < m) {
let a = data[i++];
let b = data[i++];
let c = data[i++];
out += encodeTriple(a, b, c);
sum += a + b + c;
}
开发者ID:sergezloto,项目名称:flashmagic.js,代码行数:31,代码来源:UUEncoder.ts
示例3: address
var Symbol = require('es6-symbol');
import {InSystemProgramming} from './InSystemProgramming';
import * as Utilities from './Utilities';
import {RAMAddress} from './RAMAddress';
import {ROMAddress} from './ROMAddress';
import {UUEncoder} from './UUEncoder';
const _addressSym = Symbol();
export class RAMWriter {
set address(address: RAMAddress) { this[_addressSym] = address; }
get address(): RAMAddress { return this[_addressSym]; }
constructor(private isp: InSystemProgramming) { }
writeToRAM(buffer: Buffer): Promise<RAMWriter> {
let ret: Promise<any> = this.isp.sendCommand(`W ${this.address} ${buffer.length}`)
.then(() => this.uploadChunk(buffer));
if (process.env['ISP'] === 'legacy') {
// XXX our custom bootloader sends a CMD_SUCCESS after every write ;(
ret = ret.then(() => this.isp.assertSuccess());
}
return ret.then(() => {
this.address = this.address.increment(buffer.length);
return this;
});
}
private uploadChunk(buffer: Buffer): Promise<void> {
开发者ID:sergezloto,项目名称:flashmagic.js,代码行数:31,代码来源:RAMWriter.ts
示例4: address
var Symbol = require('es6-symbol');
import * as Utilities from './Utilities';
import {MemoryBlock} from './MemoryBlock';
import {ROMAddress} from './ROMAddress';
const _addressSym = Symbol();
const _lengthSym = Symbol();
export class ROMBlock implements MemoryBlock {
get address(): number { return this[_addressSym].address; }
get sector(): number { return this[_addressSym].sector; }
get length(): number { return this[_lengthSym]; }
constructor(addr: ROMAddress, size: number) {
let n = addr.address;
if (size < 0) {
throw new RangeError(`ROM block size ${size} must be >= 0`);
}
let m = n + size - 1;
if (m > Utilities.MAX_ROM_ADDRESS) {
throw new RangeError(`ROM block [0x${n.toString(16)}...0x${m.toString(16)}] out of address space`);
}
this[_addressSym] = addr;
this[_lengthSym] = size;
}
adjust(diff: number): ROMBlock {
let size = Math.max(0, this.length - diff);
return ROMBlock.fromAddress(this.address + diff, size);
开发者ID:sergezloto,项目名称:flashmagic.js,代码行数:31,代码来源:ROMBlock.ts
示例5: BASE
var Symbol = require('es6-symbol');
import * as Utilities from './Utilities';
const _addressSym = Symbol();
const _sectorSym = Symbol();
export class ROMAddress {
static get BASE() { return 0; }
static get SIZE() { return Utilities.MAX_ROM_ADDRESS + 1; } // 504 KB
get address(): number { return this[_addressSym]; }
get sector(): number { return this[_sectorSym]; }
constructor(addr: number, sect: number) {
addr = ~~addr; // toInteger
sect = ~~sect; // toInteger
if (addr & 3) {
throw new RangeError(`ROM address 0x${addr.toString(16)} must be aligned`);
}
if (addr < ROMAddress.BASE || addr >= ROMAddress.BASE + ROMAddress.SIZE) {
throw new RangeError(`ROM address 0x${addr.toString(16)} out of range`);
}
if (sect < 0 || sect > Utilities.MAX_SECTOR) {
throw new RangeError(`ROM sector ${sect} out of range`);
}
if (Utilities.addressToSector(addr) !== sect) {
throw new RangeError(`ROM address 0x${addr.toString(16)} / sector ${sect} mismatch`);
}
this[_addressSym] = addr;
开发者ID:sergezloto,项目名称:flashmagic.js,代码行数:31,代码来源:ROMAddress.ts
注:本文中的es6-symbol.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论