mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merging
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as tracer from 'dd-trace';
|
||||
import { SpanContext } from 'opentracing';
|
||||
import SpanContext = require('dd-trace/src/opentracing/span_context');
|
||||
|
||||
tracer.init({
|
||||
service: 'MyLovelyService',
|
||||
@@ -14,7 +14,7 @@ tracer.init({
|
||||
tracer
|
||||
.trace('web.request', {
|
||||
service: 'my_service',
|
||||
childOf: new SpanContext(),
|
||||
childOf: new SpanContext({ traceId: 1337, spanId: 42 }), // Childof must be an instance of this type. See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
|
||||
tags: {
|
||||
env: 'dev'
|
||||
}
|
||||
|
||||
Vendored
+4
-1
@@ -5,6 +5,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Tracer, Span, SpanContext } from "opentracing";
|
||||
import DatadogSpanContext = require('./src/opentracing/span_context');
|
||||
|
||||
declare var trace: TraceProxy;
|
||||
export = trace;
|
||||
@@ -143,8 +144,10 @@ interface TraceOptions {
|
||||
/**
|
||||
* The parent span or span context for the new span. Generally this is not needed as it will be
|
||||
* fetched from the current context.
|
||||
* If creating your own, this must be an instance of DatadogSpanContext from ./src/opentracing/span_context
|
||||
* See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
|
||||
*/
|
||||
childOf?: Span | SpanContext;
|
||||
childOf?: Span | SpanContext | DatadogSpanContext;
|
||||
|
||||
/**
|
||||
* Global tags that should be assigned to every span.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { SpanContext } from 'opentracing';
|
||||
|
||||
declare class DatadogSpanContext extends SpanContext {
|
||||
/**
|
||||
* Used to create references to parent spans.
|
||||
* See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
|
||||
*/
|
||||
constructor(props: SpanContextLike);
|
||||
}
|
||||
|
||||
interface SpanContextLike {
|
||||
traceId: number;
|
||||
|
||||
spanId: number;
|
||||
|
||||
parentId?: number | null;
|
||||
|
||||
sampled?: boolean;
|
||||
|
||||
baggageItems?: { [key: string]: string };
|
||||
|
||||
trace?: {
|
||||
started: number[],
|
||||
finished: number[]
|
||||
}
|
||||
}
|
||||
|
||||
export = DatadogSpanContext;
|
||||
@@ -0,0 +1,11 @@
|
||||
import GCStats = require("gc-stats");
|
||||
import { GCStatistics } from "gc-stats";
|
||||
|
||||
const gcStats = GCStats();
|
||||
|
||||
gcStats.on("stats", (stats: GCStatistics) => {
|
||||
const { gctype: gcType, startTime, endTime, before, after, diff } = stats;
|
||||
const beforeMallocedMemory = before.mallocedMemory;
|
||||
const afterMallocedMemory = after.mallocedMemory;
|
||||
const diffMallocedMemory = diff.mallocedMemory;
|
||||
});
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for gc-stats 1.2
|
||||
// Project: https://github.com/dainis/node-gcstats#readme
|
||||
// Definitions by: Vitor Fernandes <https://github.com/vfernandestoptal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
declare namespace GCStats {
|
||||
interface MemoryStatistics {
|
||||
totalHeapSize: number;
|
||||
totalHeapExecutableSize: number;
|
||||
usedHeapSize: number;
|
||||
heapSizeLimit: number;
|
||||
totalPhysicalSize: number;
|
||||
totalAvailableSize: number;
|
||||
mallocedMemory: number;
|
||||
peakMallocedMemory: number;
|
||||
}
|
||||
|
||||
interface GCStatistics {
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
pause: number;
|
||||
pauseMS: number;
|
||||
gctype: 1 | 2 | 4 | 8 | 15;
|
||||
before: MemoryStatistics;
|
||||
after: MemoryStatistics;
|
||||
diff: MemoryStatistics;
|
||||
}
|
||||
}
|
||||
|
||||
declare function GCStats(): EventEmitter;
|
||||
|
||||
export = GCStats;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gc-stats-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2409
-1143
File diff suppressed because it is too large
Load Diff
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for omggif 1.0
|
||||
// Project: https://github.com/deanm/omggif
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface GifOptions {
|
||||
background?: number;
|
||||
loop?: number;
|
||||
palette?: number[];
|
||||
}
|
||||
|
||||
export interface FrameOptions {
|
||||
delay?: number;
|
||||
disposal?: number;
|
||||
palette?: number[] | null;
|
||||
transparent?: number;
|
||||
}
|
||||
|
||||
export interface Frame {
|
||||
data_length: number;
|
||||
data_offset: number;
|
||||
delay: number;
|
||||
disposal: number;
|
||||
has_local_palette: boolean;
|
||||
height: number;
|
||||
interlaced: boolean;
|
||||
palette_offset: number | null;
|
||||
palette_size: number | null;
|
||||
transparent_index: number | null;
|
||||
width: number;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export class GifWriter {
|
||||
height: number;
|
||||
width: number;
|
||||
|
||||
constructor(buf: Buffer, width: number, height: number, gopts?: GifOptions);
|
||||
|
||||
addFrame(x: number, y: number, w: number, h: number, indexed_pixels: number[], opts?: FrameOptions): number;
|
||||
end(): number;
|
||||
getOutputBuffer(): Buffer;
|
||||
getOutputBufferPosition(): number;
|
||||
setOutputBuffer(v: Buffer): void;
|
||||
setOutputBufferPosition(v: number): void;
|
||||
}
|
||||
|
||||
export class GifReader {
|
||||
constructor(buf: Buffer);
|
||||
|
||||
decodeAndBlitFrameBGRA(frame_num: number, pixels: number[]): void;
|
||||
decodeAndBlitFrameRGBA(frame_num: number, pixels: number[]): void;
|
||||
frameInfo(frame_num: number): Frame;
|
||||
loopCount(): number;
|
||||
numFrames(): number;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import * as omggif from 'omggif';
|
||||
|
||||
// (c) Dean McNamee <dean@gmail.com>, 2013.
|
||||
// Node omggif example to write out a few example images.
|
||||
|
||||
// Needs to be large enough for the final full file size. Can be any type of
|
||||
// buffer that supports [] (an Array, Uint8Array, Node Buffer, etc).
|
||||
const buf = new Buffer(1024 * 1024);
|
||||
|
||||
function gen_static_global() {
|
||||
const gf = new omggif.GifWriter(buf, 2, 2, { palette: [0xff0000, 0x0000ff] });
|
||||
gf.addFrame(0, 0, 2, 2, [0, 1, 1, 0]);
|
||||
return gf.end();
|
||||
}
|
||||
|
||||
function gen_anim() {
|
||||
// The loop parameter is the number of times to loop, or 0 for forever.
|
||||
// A value of 1 will play twice (first time, and then one loop time).
|
||||
// To play only once do not specify loop or pass null.
|
||||
const gf = new omggif.GifWriter(buf, 2, 2, { loop: 1 });
|
||||
gf.addFrame(0, 0, 2, 2, [0, 1, 1, 0], { palette: [0xff0000, 0x0000ff] });
|
||||
gf.addFrame(0, 0, 2, 2, [1, 0, 0, 1], {
|
||||
palette: [0xff0000, 0x0000ff],
|
||||
delay: 10,
|
||||
}); // Delay in hundredths of a sec (100 = 1s).
|
||||
return gf.end();
|
||||
}
|
||||
|
||||
function gen_gray_strip() {
|
||||
const gf = new omggif.GifWriter(buf, 256, 1);
|
||||
const palette = [];
|
||||
const indices = [];
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
palette.push((i << 16) | (i << 8) | i);
|
||||
indices.push(i);
|
||||
}
|
||||
gf.addFrame(0, 0, 256, 1, indices, { palette });
|
||||
return gf.end();
|
||||
}
|
||||
|
||||
// More than 8-bit color (via tiling of several frames). Browsers seem to
|
||||
// treat this as an animation though, with an enforced minimum time between
|
||||
// frames which makes it animated instead of the intended static image.
|
||||
function gen_color_strip() {
|
||||
const gf = new omggif.GifWriter(buf, 256, 256, {
|
||||
palette: [0x000000, 0xff0000],
|
||||
background: 1,
|
||||
});
|
||||
|
||||
const indices = [];
|
||||
for (let i = 0; i < 256; ++i) indices.push(i);
|
||||
|
||||
for (let j = 0; j < 256; ++j) {
|
||||
const palette = [];
|
||||
for (let i = 0; i < 256; ++i) palette.push((j << 16) | (i << 8) | i);
|
||||
gf.addFrame(0, j, 256, 1, indices, { palette, disposal: 1 });
|
||||
}
|
||||
return gf.end();
|
||||
}
|
||||
|
||||
// 1x1 white, generates the same as Google's 35 byte __utm.gif, except for some
|
||||
// reason that I'm not sure of they set their background index to 255.
|
||||
function gen_empty_white() {
|
||||
const gf = new omggif.GifWriter(buf, 1, 1, { palette: [0xffffff, 0x000000] });
|
||||
gf.addFrame(0, 0, 1, 1, [0]);
|
||||
return gf.end();
|
||||
}
|
||||
|
||||
// with lzw block of 256.
|
||||
// see: https://github.com/deanm/omggif/issues/5
|
||||
function gen_block256() {
|
||||
const width = 4840;
|
||||
const gf = new omggif.GifWriter(buf, width, 1, {
|
||||
palette: [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000],
|
||||
});
|
||||
const stream = Array(width);
|
||||
for (let i = 0; i < width; ++i) stream[i] = i & 0x7;
|
||||
gf.addFrame(0, 0, width, 1, stream, { transparent: 0 });
|
||||
const data = buf.slice(0, gf.end());
|
||||
// Make sure it decodes.
|
||||
const gr = new omggif.GifReader(data);
|
||||
const frameInfo = gr.frameInfo(0);
|
||||
return frameInfo;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"omggif-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+8
-7
@@ -9,6 +9,7 @@
|
||||
// Yair Tawil <https://github.com/yairtawil>
|
||||
// Pierre Marchand <https://github.com/pierremarc>
|
||||
// Hauke Stieler <https://github.com/hauke96>
|
||||
// Guillaume Beraudo <https://github.com/gberaudo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc)
|
||||
|
||||
@@ -1715,7 +1716,7 @@ export class Feature extends Object {
|
||||
* representing the current style of this feature.
|
||||
* @api stable
|
||||
*/
|
||||
getStyleFunction(): (ol.FeatureStyleFunction);
|
||||
getStyleFunction(): (ol.FeatureStyleFunction | undefined);
|
||||
|
||||
/**
|
||||
* Set the default geometry for the feature. This will update the property
|
||||
@@ -6412,7 +6413,7 @@ export namespace layer {
|
||||
* @return Layer style function.
|
||||
* @api stable
|
||||
*/
|
||||
getStyleFunction(): (ol.StyleFunction);
|
||||
getStyleFunction(): (ol.StyleFunction | undefined);
|
||||
|
||||
/**
|
||||
* Set the style for features. This can be a single style object, an array
|
||||
@@ -6424,7 +6425,7 @@ export namespace layer {
|
||||
* @param style Layer style.
|
||||
* @api stable
|
||||
*/
|
||||
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null)): void;
|
||||
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8472,7 +8473,7 @@ export namespace source {
|
||||
* @return Layer style function.
|
||||
* @api stable
|
||||
*/
|
||||
getStyleFunction(): (ol.StyleFunction);
|
||||
getStyleFunction(): (ol.StyleFunction | undefined);
|
||||
|
||||
/**
|
||||
* Set the style for features. This can be a single style object, an array
|
||||
@@ -8484,7 +8485,7 @@ export namespace source {
|
||||
* @param style Layer style.
|
||||
* @api stable
|
||||
*/
|
||||
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction)): void;
|
||||
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10831,7 +10832,7 @@ export type FeatureLoader = (extent: ol.Extent, resolution: number, proj: ol.pro
|
||||
* {@link ol.Feature} to be styled.
|
||||
*
|
||||
*/
|
||||
export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[]);
|
||||
export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[] | null);
|
||||
|
||||
/**
|
||||
* {@link ol.source.Vector} sources use a function of this type to get the url
|
||||
@@ -10981,7 +10982,7 @@ export interface StyleImageOptions {
|
||||
* or an array of them. This way e.g. a vector layer can be styled.
|
||||
*
|
||||
*/
|
||||
export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[]);
|
||||
export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[] | null);
|
||||
|
||||
/**
|
||||
* A function that takes an {@link ol.Feature} as argument and returns an
|
||||
|
||||
@@ -418,6 +418,14 @@ feature.setStyle(styleArray);
|
||||
feature.setStyle(featureStyleFunction);
|
||||
feature.setStyle(styleFunction);
|
||||
feature.setProperties(object);
|
||||
const nullStyleFunction = (feature: (ol.Feature|ol.render.Feature), resolution: number): null => {
|
||||
return null;
|
||||
};
|
||||
const nullFeatureStyleFunction = (resolution: number): null => {
|
||||
return null;
|
||||
};
|
||||
feature.setStyle(nullStyleFunction);
|
||||
feature.setStyle(nullFeatureStyleFunction);
|
||||
|
||||
//
|
||||
// ol.View
|
||||
@@ -573,6 +581,10 @@ const vectorLayer: ol.layer.Vector = new ol.layer.Vector({
|
||||
zIndex: -1
|
||||
});
|
||||
|
||||
vectorLayer.setStyle(nullStyleFunction);
|
||||
vectorLayer.setStyle(null);
|
||||
vectorLayer.setStyle(undefined);
|
||||
|
||||
//
|
||||
// ol.layer.VectorTile
|
||||
//
|
||||
|
||||
Vendored
+1
@@ -15,6 +15,7 @@ import { Duplex } from "stream";
|
||||
* @throws {Error} Invalid parameters
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
*/
|
||||
declare function sharp(options?: sharp.SharpOptions): sharp.SharpInstance;
|
||||
declare function sharp(input?: string | Buffer, options?: sharp.SharpOptions): sharp.SharpInstance;
|
||||
declare namespace sharp {
|
||||
const gravity: GravityEnum;
|
||||
|
||||
@@ -47,6 +47,17 @@ sharp('input.jpg')
|
||||
// containing a scaled and cropped version of input.jpg
|
||||
});
|
||||
|
||||
sharp({
|
||||
create: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
channels: 4,
|
||||
background: { r: 255, g: 0, b: 0, alpha: 128 }
|
||||
}
|
||||
})
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
let transformer = sharp()
|
||||
.resize(300)
|
||||
.on('info', (info: sharp.OutputInfo) => {
|
||||
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for snappy 6.0
|
||||
// Project: https://github.com/kesla/node-snappy
|
||||
// Definitions by: Francis Gulotta <https://github.com/reconbot>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference types="node"/>
|
||||
|
||||
export interface SnappyDecompressOpts {
|
||||
asBuffer: boolean;
|
||||
}
|
||||
|
||||
export type bufferCallback = (err: Error | null, data: Buffer) => void;
|
||||
export type bufferOrStringCallback = (err: Error | null, data: Buffer|string) => void;
|
||||
export type booleanCallback = (err: Error | null, data: boolean) => void;
|
||||
|
||||
export function compress(buffer: Buffer|string, callback: bufferCallback): void;
|
||||
export function compressSync(buffer: Buffer|string): Buffer;
|
||||
|
||||
export function uncompress(buffer: Buffer, callback: bufferCallback): void;
|
||||
export function uncompress(buffer: Buffer, options: SnappyDecompressOpts, callback: bufferOrStringCallback): void;
|
||||
export function uncompressSync(buffer: Buffer): Buffer;
|
||||
export function uncompressSync(buffer: Buffer, options: SnappyDecompressOpts): Buffer|string;
|
||||
|
||||
export function isValidCompressed(buffer: Buffer, callback: booleanCallback): void;
|
||||
export function isValidCompressedSync(buffer: Buffer): boolean;
|
||||
@@ -0,0 +1,35 @@
|
||||
import * as snappy from 'snappy';
|
||||
|
||||
snappy.compress('beep boop', (err, compressed) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
console.log(compressed.slice(0, 1));
|
||||
});
|
||||
|
||||
const data = snappy.compressSync('beep boop');
|
||||
const otherData = snappy.compressSync(Buffer.from('beep boop'));
|
||||
snappy.uncompress(data, (err, data) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
console.log(data.toString('UTF8'));
|
||||
});
|
||||
snappy.uncompress(otherData, { asBuffer: false }, (err, original) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
console.log('the original String', original);
|
||||
});
|
||||
|
||||
snappy.uncompressSync(data);
|
||||
snappy.uncompressSync(data, { asBuffer: false });
|
||||
snappy.isValidCompressed(data, (err, valid) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
console.log(valid);
|
||||
});
|
||||
if (snappy.isValidCompressedSync(data)) {
|
||||
console.log('valid!');
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"snappy-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+27
-15
@@ -132,14 +132,20 @@ declare namespace webpack {
|
||||
}
|
||||
|
||||
interface Output {
|
||||
/** The output directory as absolute path. */
|
||||
path?: string;
|
||||
/** When used in tandem with output.library and output.libraryTarget, this option allows users to insert comments within the export wrapper. */
|
||||
auxiliaryComment?: string | AuxiliaryCommentObject;
|
||||
/** The filename of the entry chunk as relative path inside the output.path directory. */
|
||||
filename?: string;
|
||||
/** The filename of non-entry chunks as relative path inside the output.path directory. */
|
||||
chunkFilename?: string;
|
||||
/** The filename of the SourceMaps for the JavaScript files. They are inside the output.path directory. */
|
||||
sourceMapFilename?: string;
|
||||
/** Number of milliseconds before chunk request expires, defaults to 120,000. */
|
||||
chunkLoadTimeout?: number;
|
||||
/** This option enables cross-origin loading of chunks. */
|
||||
crossOriginLoading?: string | boolean;
|
||||
/** The JSONP function used by webpack for asnyc loading of chunks. */
|
||||
jsonpFunction?: string;
|
||||
/** Allows customization of the script type webpack injects script tags into the DOM to download async chunks. */
|
||||
jsonpScriptType?: 'text/javascript' | 'module';
|
||||
/** Filename template string of function for the sources array in a generated SourceMap. */
|
||||
devtoolModuleFilenameTemplate?: string | ((info: DevtoolModuleFilenameTemplateInfo) => string);
|
||||
/** Similar to output.devtoolModuleFilenameTemplate, but used in the case of duplicate module identifiers. */
|
||||
@@ -151,18 +157,14 @@ declare namespace webpack {
|
||||
* true enables it for all modules (not recommended)
|
||||
*/
|
||||
devtoolLineToLine?: boolean;
|
||||
/** This option determines the modules namespace used with the output.devtoolModuleFilenameTemplate. */
|
||||
devtoolNamespace?: string;
|
||||
/** The filename of the Hot Update Chunks. They are inside the output.path directory. */
|
||||
hotUpdateChunkFilename?: string;
|
||||
/** The filename of the Hot Update Main File. It is inside the output.path directory. */
|
||||
hotUpdateMainFilename?: string;
|
||||
/** The output.path from the view of the Javascript / HTML page. */
|
||||
publicPath?: string;
|
||||
/** The JSONP function used by webpack for asnyc loading of chunks. */
|
||||
jsonpFunction?: string;
|
||||
/** The JSONP function used by webpack for async loading of hot update chunks. */
|
||||
hotUpdateFunction?: string;
|
||||
/** Include comments with information about the modules. */
|
||||
pathinfo?: boolean;
|
||||
/** The filename of the Hot Update Main File. It is inside the output.path directory. */
|
||||
hotUpdateMainFilename?: string;
|
||||
/** If set, export the bundle as library. output.library is the name. */
|
||||
library?: string | string[];
|
||||
/**
|
||||
@@ -177,15 +179,21 @@ declare namespace webpack {
|
||||
* - "assign" - Assign to a global variable
|
||||
* - "jsonp" - Generate Webpack JSONP module
|
||||
*/
|
||||
libraryTarget?: 'var' | 'this' | 'commonjs' | 'commonjs2' | 'amd' | 'umd' | 'window' | 'assign' | 'jsonp';
|
||||
libraryTarget?: LibraryTarget;
|
||||
/** Configure which module or modules will be exposed via the `libraryTarget` */
|
||||
libraryExport?: string | string[];
|
||||
/** If output.libraryTarget is set to umd and output.library is set, setting this to true will name the AMD module. */
|
||||
umdNamedDefine?: boolean;
|
||||
/** The output directory as absolute path. */
|
||||
path?: string;
|
||||
/** Include comments with information about the modules. */
|
||||
pathinfo?: boolean;
|
||||
/** The output.path from the view of the Javascript / HTML page. */
|
||||
publicPath?: string;
|
||||
/** The filename of the SourceMaps for the JavaScript files. They are inside the output.path directory. */
|
||||
sourceMapFilename?: string;
|
||||
/** Prefixes every line of the source in the bundle with this string. */
|
||||
sourcePrefix?: string;
|
||||
/** This option enables cross-origin loading of chunks. */
|
||||
crossOriginLoading?: string | boolean;
|
||||
/** The encoding to use when generating the hash, defaults to 'hex' */
|
||||
hashDigest?: 'hex' | 'latin1' | 'base64';
|
||||
/** The prefix length of the hash digest to use, defaults to 20. */
|
||||
@@ -198,6 +206,10 @@ declare namespace webpack {
|
||||
globalObject?: string;
|
||||
}
|
||||
|
||||
type LibraryTarget = 'var' | 'assign' | 'this' | 'window' | 'global' | 'commonjs' | 'commonjs2' | 'amd' | 'umd' | 'jsonp';
|
||||
|
||||
type AuxiliaryCommentObject = { [P in LibraryTarget]: string };
|
||||
|
||||
interface Module {
|
||||
/** A array of applied pre loaders. */
|
||||
preLoaders?: RuleSetRule[];
|
||||
|
||||
Vendored
+3426
-3208
File diff suppressed because it is too large
Load Diff
@@ -1,320 +1,341 @@
|
||||
getCurrentPages();
|
||||
|
||||
let behavior = Behavior({
|
||||
behaviors: [],
|
||||
properties: {
|
||||
myBehaviorProperty: {
|
||||
type: String
|
||||
behaviors: [],
|
||||
properties: {
|
||||
myBehaviorProperty: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data: {
|
||||
myBehaviorData: {}
|
||||
},
|
||||
attached() {},
|
||||
methods: {
|
||||
myBehaviorMethod() {
|
||||
this.myBehaviorData;
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
myBehaviorData: {}
|
||||
},
|
||||
attached() { },
|
||||
methods: {
|
||||
myBehaviorMethod() {
|
||||
this.myBehaviorData;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Component({
|
||||
behaviors: [behavior, 'wx://form-field'],
|
||||
behaviors: [behavior, "wx://form-field"],
|
||||
|
||||
properties: {
|
||||
myProperty: { // 属性名
|
||||
type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
|
||||
value: '', // 属性初始值(可选),如果未指定则会根据类型选择一个
|
||||
observer(newVal: string, oldVal: string) { } // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
|
||||
properties: {
|
||||
myProperty: {
|
||||
// 属性名
|
||||
type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
|
||||
value: "", // 属性初始值(可选),如果未指定则会根据类型选择一个
|
||||
observer(newVal: string, oldVal: string) {} // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
|
||||
},
|
||||
myProperty2: String // 简化的定义方式
|
||||
},
|
||||
myProperty2: String // 简化的定义方式
|
||||
},
|
||||
data: {
|
||||
key: 'value',
|
||||
anotherKey: 'value'
|
||||
}, // 私有数据,可用于模版渲染
|
||||
data: {
|
||||
key: "value",
|
||||
anotherKey: "value"
|
||||
}, // 私有数据,可用于模版渲染
|
||||
|
||||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||||
attached() {
|
||||
this.setData({}, () => { });
|
||||
},
|
||||
moved() { },
|
||||
detached() { },
|
||||
methods: {
|
||||
onMyButtonTap() {
|
||||
// 更新属性和数据的方法与更新页面数据的方法类似
|
||||
this.setData({
|
||||
key: 123 // note this is edge case where it cannot detect wrong types...
|
||||
});
|
||||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||||
attached() {
|
||||
this.setData({}, () => {});
|
||||
},
|
||||
_myPrivateMethod() {
|
||||
// 内部方法建议以下划线开头
|
||||
// this.replaceDataOnPath(['A', 0, 'B'], 'myPrivateData'); // 这里将 data.A[0].B 设为 'myPrivateData'
|
||||
// this.applyDataUpdates();
|
||||
this.setData({
|
||||
anotherKey: 123
|
||||
});
|
||||
moved() {},
|
||||
detached() {},
|
||||
methods: {
|
||||
onMyButtonTap() {
|
||||
// 更新属性和数据的方法与更新页面数据的方法类似
|
||||
this.setData({
|
||||
key: 123 // note this is edge case where it cannot detect wrong types...
|
||||
});
|
||||
},
|
||||
_myPrivateMethod() {
|
||||
// 内部方法建议以下划线开头
|
||||
// this.replaceDataOnPath(['A', 0, 'B'], 'myPrivateData'); // 这里将 data.A[0].B 设为 'myPrivateData'
|
||||
// this.applyDataUpdates();
|
||||
this.setData({
|
||||
anotherKey: 123
|
||||
});
|
||||
},
|
||||
_propertyChange(newVal: string, oldVal: string) {
|
||||
//
|
||||
}
|
||||
},
|
||||
_propertyChange(newVal: string, oldVal: string) {
|
||||
//
|
||||
relations: {
|
||||
"./custom-ul": {
|
||||
type: "parent", // 关联的目标节点应为父节点
|
||||
linked(target) {
|
||||
// 每次被插入到custom-ul时执行,target是custom-ul节点实例对象,触发在attached生命周期之后
|
||||
},
|
||||
linkChanged(target) {
|
||||
// 每次被移动后执行,target是custom-ul节点实例对象,触发在moved生命周期之后
|
||||
},
|
||||
unlinked(target) {
|
||||
// 每次被移除时执行,target是custom-ul节点实例对象,触发在detached生命周期之后
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
relations: {
|
||||
'./custom-ul': {
|
||||
type: 'parent', // 关联的目标节点应为父节点
|
||||
linked(target) {
|
||||
// 每次被插入到custom-ul时执行,target是custom-ul节点实例对象,触发在attached生命周期之后
|
||||
},
|
||||
linkChanged(target) {
|
||||
// 每次被移动后执行,target是custom-ul节点实例对象,触发在moved生命周期之后
|
||||
},
|
||||
unlinked(target) {
|
||||
// 每次被移除时执行,target是custom-ul节点实例对象,触发在detached生命周期之后
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// index.js
|
||||
Page({
|
||||
data: {
|
||||
text: "This is page data."
|
||||
},
|
||||
onLoad() {
|
||||
// Do some initialize when page load.
|
||||
this.setData({}, () => {
|
||||
// callback
|
||||
});
|
||||
},
|
||||
onReady: () => {
|
||||
// Do something when page ready.
|
||||
},
|
||||
onShow: () => {
|
||||
// Do something when page show.
|
||||
},
|
||||
onHide: () => {
|
||||
// Do something when page hide.
|
||||
},
|
||||
onUnload: () => {
|
||||
// Do something when page close.
|
||||
},
|
||||
onPullDownRefresh: () => {
|
||||
// Do something when pull down.
|
||||
},
|
||||
onReachBottom: () => {
|
||||
// Do something when page reach bottom.
|
||||
},
|
||||
onShareAppMessage: (res) => {
|
||||
if (res && res.from === 'menu') {
|
||||
//
|
||||
data: {
|
||||
text: "This is page data."
|
||||
},
|
||||
onLoad() {
|
||||
// Do some initialize when page load.
|
||||
this.setData({}, () => {
|
||||
// callback
|
||||
});
|
||||
},
|
||||
onReady: () => {
|
||||
// Do something when page ready.
|
||||
},
|
||||
onShow: () => {
|
||||
// Do something when page show.
|
||||
},
|
||||
onHide: () => {
|
||||
// Do something when page hide.
|
||||
},
|
||||
onUnload: () => {
|
||||
// Do something when page close.
|
||||
},
|
||||
onPullDownRefresh: () => {
|
||||
// Do something when pull down.
|
||||
},
|
||||
onReachBottom: () => {
|
||||
// Do something when page reach bottom.
|
||||
},
|
||||
onShareAppMessage: res => {
|
||||
if (res && res.from === "menu") {
|
||||
//
|
||||
}
|
||||
// return custom share data when user share.
|
||||
return {
|
||||
success(res) {
|
||||
console.log(res.shareTickets.length);
|
||||
}
|
||||
};
|
||||
},
|
||||
onPageScroll: () => {
|
||||
// this.
|
||||
// Do something when page scroll
|
||||
},
|
||||
onTabItemTap(item: any) {
|
||||
this.setData({
|
||||
1: null,
|
||||
_2: "undefined"
|
||||
});
|
||||
console.log(item.index);
|
||||
console.log(item.pagePath);
|
||||
console.log(item.text);
|
||||
},
|
||||
// Event handler.
|
||||
viewTap() {
|
||||
this.setData(
|
||||
{
|
||||
text: "Set some data for updating view."
|
||||
},
|
||||
() => {
|
||||
// this is setData callback
|
||||
}
|
||||
);
|
||||
},
|
||||
customData: {
|
||||
hi: "MINA"
|
||||
}
|
||||
// return custom share data when user share.
|
||||
return {
|
||||
success(res) {
|
||||
console.log(res.shareTickets.length);
|
||||
}
|
||||
};
|
||||
},
|
||||
onPageScroll: () => {
|
||||
// this.
|
||||
// Do something when page scroll
|
||||
},
|
||||
onTabItemTap(item: any) {
|
||||
this.setData({
|
||||
1: null,
|
||||
_2: "undefined"
|
||||
});
|
||||
console.log(item.index);
|
||||
console.log(item.pagePath);
|
||||
console.log(item.text);
|
||||
},
|
||||
// Event handler.
|
||||
viewTap() {
|
||||
this.setData({
|
||||
text: 'Set some data for updating view.'
|
||||
}, () => {
|
||||
// this is setData callback
|
||||
});
|
||||
},
|
||||
customData: {
|
||||
hi: 'MINA'
|
||||
}
|
||||
});
|
||||
|
||||
Page({
|
||||
getScrollOffset: () => {
|
||||
wx.createSelectorQuery().selectViewport().scrollOffset((res) => {
|
||||
res.id; // 节点的ID
|
||||
res.dataset; // 节点的dataset
|
||||
res.scrollLeft; // 节点的水平滚动位置
|
||||
res.scrollTop; // 节点的竖直滚动位置
|
||||
}).exec();
|
||||
}
|
||||
getScrollOffset: () => {
|
||||
wx.createSelectorQuery()
|
||||
.selectViewport()
|
||||
.scrollOffset(res => {
|
||||
res.id; // 节点的ID
|
||||
res.dataset; // 节点的dataset
|
||||
res.scrollLeft; // 节点的水平滚动位置
|
||||
res.scrollTop; // 节点的竖直滚动位置
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
});
|
||||
|
||||
Page({
|
||||
getFields: () => {
|
||||
wx.createSelectorQuery().select('#the-id').fields({
|
||||
id: true,
|
||||
dataset: true,
|
||||
size: true,
|
||||
scrollOffset: true,
|
||||
properties: ['scrollX', 'scrollY']
|
||||
}, (res) => {
|
||||
// res.
|
||||
res.dataset; // 节点的dataset
|
||||
res.width; // 节点的宽度
|
||||
res.height; // 节点的高度
|
||||
res.scrollLeft; // 节点的水平滚动位置
|
||||
res.scrollTop; // 节点的竖直滚动位置
|
||||
res.scrollX; // 节点 scroll-x 属性的当前值
|
||||
res.scrollY; // 节点 scroll-x 属性的当前值
|
||||
}).exec();
|
||||
}
|
||||
getFields: () => {
|
||||
wx.createSelectorQuery()
|
||||
.select("#the-id")
|
||||
.fields(
|
||||
{
|
||||
id: true,
|
||||
dataset: true,
|
||||
size: true,
|
||||
scrollOffset: true,
|
||||
properties: ["scrollX", "scrollY"]
|
||||
},
|
||||
res => {
|
||||
// res.
|
||||
res.dataset; // 节点的dataset
|
||||
res.width; // 节点的宽度
|
||||
res.height; // 节点的高度
|
||||
res.scrollLeft; // 节点的水平滚动位置
|
||||
res.scrollTop; // 节点的竖直滚动位置
|
||||
res.scrollX; // 节点 scroll-x 属性的当前值
|
||||
res.scrollY; // 节点 scroll-x 属性的当前值
|
||||
}
|
||||
)
|
||||
.exec();
|
||||
}
|
||||
});
|
||||
|
||||
Page({
|
||||
getRect: () => {
|
||||
wx.createSelectorQuery().select('#the-id').boundingClientRect((rect: wx.NodesRefRect) => {
|
||||
rect.id; // 节点的ID
|
||||
rect.dataset; // 节点的dataset
|
||||
rect.left; // 节点的左边界坐标
|
||||
rect.right; // 节点的右边界坐标
|
||||
rect.top; // 节点的上边界坐标
|
||||
rect.bottom; // 节点的下边界坐标
|
||||
rect.width; // 节点的宽度
|
||||
rect.height; // 节点的高度
|
||||
}).exec();
|
||||
},
|
||||
getAllRects: () => {
|
||||
wx.createSelectorQuery().selectAll('.a-class').boundingClientRect((rects: wx.NodesRefRect[]) => {
|
||||
rects.forEach((rect) => {
|
||||
rect.id; // 节点的ID
|
||||
rect.dataset; // 节点的dataset
|
||||
rect.left; // 节点的左边界坐标
|
||||
rect.right; // 节点的右边界坐标
|
||||
rect.top; // 节点的上边界坐标
|
||||
rect.bottom; // 节点的下边界坐标
|
||||
rect.width; // 节点的宽度
|
||||
rect.height; // 节点的高度
|
||||
});
|
||||
}).exec();
|
||||
}
|
||||
getRect: () => {
|
||||
wx.createSelectorQuery()
|
||||
.select("#the-id")
|
||||
.boundingClientRect((rect: wx.NodesRefRect) => {
|
||||
rect.id; // 节点的ID
|
||||
rect.dataset; // 节点的dataset
|
||||
rect.left; // 节点的左边界坐标
|
||||
rect.right; // 节点的右边界坐标
|
||||
rect.top; // 节点的上边界坐标
|
||||
rect.bottom; // 节点的下边界坐标
|
||||
rect.width; // 节点的宽度
|
||||
rect.height; // 节点的高度
|
||||
})
|
||||
.exec();
|
||||
},
|
||||
getAllRects: () => {
|
||||
wx.createSelectorQuery()
|
||||
.selectAll(".a-class")
|
||||
.boundingClientRect((rects: wx.NodesRefRect[]) => {
|
||||
rects.forEach(rect => {
|
||||
rect.id; // 节点的ID
|
||||
rect.dataset; // 节点的dataset
|
||||
rect.left; // 节点的左边界坐标
|
||||
rect.right; // 节点的右边界坐标
|
||||
rect.top; // 节点的上边界坐标
|
||||
rect.bottom; // 节点的下边界坐标
|
||||
rect.width; // 节点的宽度
|
||||
rect.height; // 节点的高度
|
||||
});
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
});
|
||||
|
||||
const recorderManager = wx.getRecorderManager();
|
||||
|
||||
recorderManager.onStart(() => {
|
||||
console.log('recorder start');
|
||||
console.log("recorder start");
|
||||
});
|
||||
recorderManager.onResume(() => {
|
||||
console.log('recorder resume');
|
||||
console.log("recorder resume");
|
||||
});
|
||||
recorderManager.onPause(() => {
|
||||
console.log('recorder pause');
|
||||
console.log("recorder pause");
|
||||
});
|
||||
recorderManager.onStop((res) => {
|
||||
console.log('recorder stop', res);
|
||||
const { tempFilePath } = res;
|
||||
recorderManager.onStop(res => {
|
||||
console.log("recorder stop", res);
|
||||
const { tempFilePath } = res;
|
||||
});
|
||||
recorderManager.onFrameRecorded((res) => {
|
||||
const { frameBuffer } = res;
|
||||
console.log('frameBuffer.byteLength', frameBuffer.byteLength);
|
||||
recorderManager.onFrameRecorded(res => {
|
||||
const { frameBuffer } = res;
|
||||
console.log("frameBuffer.byteLength", frameBuffer.byteLength);
|
||||
});
|
||||
|
||||
const options = {
|
||||
duration: 10000,
|
||||
sampleRate: 44100,
|
||||
numberOfChannels: 1,
|
||||
encodeBitRate: 192000,
|
||||
format: 'aac',
|
||||
frameSize: 50
|
||||
duration: 10000,
|
||||
sampleRate: 44100,
|
||||
numberOfChannels: 1,
|
||||
encodeBitRate: 192000,
|
||||
format: "aac",
|
||||
frameSize: 50
|
||||
};
|
||||
|
||||
recorderManager.start(options);
|
||||
|
||||
wx.onGetWifiList((res) => {
|
||||
if (res.wifiList.length) {
|
||||
wx.setWifiList({
|
||||
wifiList: [{
|
||||
SSID: res.wifiList[0].SSID,
|
||||
BSSID: res.wifiList[0].BSSID,
|
||||
password: '123456'
|
||||
}]
|
||||
});
|
||||
} else {
|
||||
wx.setWifiList({
|
||||
wifiList: []
|
||||
});
|
||||
}
|
||||
wx.onGetWifiList(res => {
|
||||
if (res.wifiList.length) {
|
||||
wx.setWifiList({
|
||||
wifiList: [
|
||||
{
|
||||
SSID: res.wifiList[0].SSID,
|
||||
BSSID: res.wifiList[0].BSSID,
|
||||
password: "123456"
|
||||
}
|
||||
]
|
||||
});
|
||||
} else {
|
||||
wx.setWifiList({
|
||||
wifiList: []
|
||||
});
|
||||
}
|
||||
});
|
||||
wx.getWifiList();
|
||||
|
||||
wx.onWifiConnected((wifi) => {
|
||||
// wifi.BSSID
|
||||
wx.onWifiConnected(wifi => {
|
||||
// wifi.BSSID
|
||||
});
|
||||
|
||||
wx.getConnectedWifi({
|
||||
success(result) {
|
||||
result.signalStrength;
|
||||
}
|
||||
success(result) {
|
||||
result.signalStrength;
|
||||
}
|
||||
});
|
||||
|
||||
wx.getWeRunData({
|
||||
success(res) {
|
||||
const encryptedData = res.encryptedData;
|
||||
}
|
||||
success(res) {
|
||||
const encryptedData = res.encryptedData;
|
||||
}
|
||||
});
|
||||
|
||||
const uploadTask = wx.uploadFile({
|
||||
url: 'http://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
|
||||
filePath: '/local/folder/file.ext',
|
||||
name: 'file',
|
||||
formData: {
|
||||
user: 'test'
|
||||
},
|
||||
success: (res) => {
|
||||
const data = res.data;
|
||||
// do something
|
||||
}
|
||||
url: "http://example.weixin.qq.com/upload", // 仅为示例,非真实的接口地址
|
||||
filePath: "/local/folder/file.ext",
|
||||
name: "file",
|
||||
formData: {
|
||||
user: "test"
|
||||
},
|
||||
success: res => {
|
||||
const data = res.data;
|
||||
// do something
|
||||
}
|
||||
});
|
||||
|
||||
uploadTask.onProgressUpdate((res) => {
|
||||
console.log('上传进度', res.progress);
|
||||
console.log('已经上传的数据长度', res.totalBytesSent);
|
||||
console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend);
|
||||
uploadTask.onProgressUpdate(res => {
|
||||
console.log("上传进度", res.progress);
|
||||
console.log("已经上传的数据长度", res.totalBytesSent);
|
||||
console.log("预期需要上传的数据总长度", res.totalBytesExpectedToSend);
|
||||
});
|
||||
|
||||
uploadTask.abort(); // 取消上传任务
|
||||
|
||||
const downloadTask = wx.downloadFile({
|
||||
url: 'http://example.com/audio/123', // 仅为示例,并非真实的资源
|
||||
success: (res) => {
|
||||
wx.playVoice({
|
||||
filePath: res.tempFilePath
|
||||
});
|
||||
}
|
||||
url: "http://example.com/audio/123", // 仅为示例,并非真实的资源
|
||||
success: res => {
|
||||
wx.playVoice({
|
||||
filePath: res.tempFilePath
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
downloadTask.onProgressUpdate((res) => {
|
||||
console.log('下载进度', res.progress);
|
||||
console.log('已经下载的数据长度', res.totalBytesWritten);
|
||||
console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite);
|
||||
downloadTask.onProgressUpdate(res => {
|
||||
console.log("下载进度", res.progress);
|
||||
console.log("已经下载的数据长度", res.totalBytesWritten);
|
||||
console.log("预期需要下载的数据总长度", res.totalBytesExpectedToWrite);
|
||||
});
|
||||
|
||||
downloadTask.abort(); // 取消下载任务
|
||||
|
||||
wx.request({
|
||||
url: 'https://www.baidu.com',
|
||||
method: 'GET',
|
||||
success(res) {
|
||||
if (res.statusCode < 300) {
|
||||
console.log(res.data);
|
||||
} else {
|
||||
console.warn(res.statusCode, res.header);
|
||||
url: "https://www.baidu.com",
|
||||
method: "GET",
|
||||
success(res) {
|
||||
if (res.statusCode < 300) {
|
||||
console.log(res.data);
|
||||
} else {
|
||||
console.warn(res.statusCode, res.header);
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
console.error(e);
|
||||
}
|
||||
}).abort();
|
||||
|
||||
Reference in New Issue
Block a user