This commit is contained in:
David Newell
2016-07-29 10:14:00 -04:00
15 changed files with 286 additions and 66 deletions
@@ -284,7 +284,6 @@ app.on('ready', () => {
app.commandLine.appendSwitch('remote-debugging-port', '8315');
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
app.commandLine.appendSwitch('v', -1);
app.commandLine.appendSwitch('vmodule', 'console=0');
// systemPreferences
@@ -766,6 +765,8 @@ let image2 = nativeImage.createFromPath('/Users/somebody/images/icon.png');
// process
// https://github.com/electron/electron/blob/master/docs/api/process.md
console.log(process.versions.electron);
console.log(process.versions.chrome);
console.log(process.type);
console.log(process.resourcesPath);
console.log(process.mas);
+53 -18
View File
@@ -1,4 +1,4 @@
// Type definitions for Electron v1.2.8
// Type definitions for Electron v1.3.1
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -401,7 +401,7 @@ declare namespace Electron {
* Note: This will not affect process.argv, and is mainly used by developers
* to control some low-level Chromium behaviors.
*/
appendSwitch(_switch: string, value?: string|number): void;
appendSwitch(_switch: string, value?: string): void;
/**
* Append an argument to Chromium's command line. The argument will quoted properly.
*
@@ -2799,7 +2799,7 @@ declare namespace Electron {
/**
* Sets the proxy settings.
*/
setProxy(config: string, callback: Function): void;
setProxy(config: ProxyConfig, callback: Function): void;
/**
* Resolves the proxy information for url.
*/
@@ -2882,6 +2882,21 @@ declare namespace Electron {
quotas?: ('temporary' | 'persistent' | 'syncable')[];
}
interface ProxyConfig {
/**
* The URL associated with the PAC file.
*/
pacScript: string;
/**
* Rules indicating which proxies to use.
*/
proxyRules: string;
/**
* Rules indicating which URLs should bypass the proxy settings.
*/
proxyBypassRules: string;
}
interface NetworkEmulationOptions {
/**
* Whether to emulate network outage.
@@ -3386,10 +3401,10 @@ declare namespace Electron {
*/
setTitle(title: string): void;
/**
* Sets whether the tray icon is highlighted when it is clicked.
* Sets when the tray's icon background becomes highlighted.
* Note: This is only implemented on macOS.
*/
setHighlightMode(highlight: boolean): void;
setHighlightMode(mode: 'selection' | 'always' | 'never'): void;
/**
* Displays a tray balloon.
* Note: This is only implemented on Windows.
@@ -3641,6 +3656,10 @@ declare namespace Electron {
* passing empty string to callback will cancel the request.
*/
on(event: 'select-bluetooth-device', listener: (event: Event, deviceList: BluetoothDevice[], callback: (deviceId: string) => void) => void): this;
/**
* Emitted when a page's view is repainted.
*/
on(event: 'view-painted', listener: Function): this;
on(event: string, listener: Function): this;
/**
* Loads the url in the window.
@@ -3751,47 +3770,51 @@ declare namespace Electron {
*/
isAudioMuted(): boolean;
/**
* Executes Edit -> Undo command in page.
* Executes the editing command undo in web page.
*/
undo(): void;
/**
* Executes Edit -> Redo command in page.
* Executes the editing command redo in web page.
*/
redo(): void;
/**
* Executes Edit -> Cut command in page.
* Executes the editing command cut in web page.
*/
cut(): void;
/**
* Executes Edit -> Copy command in page.
* Executes the editing command copy in web page.
*/
copy(): void;
/**
* Executes Edit -> Paste command in page.
* Copy the image at the given position to the clipboard.
*/
copyImageAt(x: number, y: number): void;
/**
* Executes the editing command paste in web page.
*/
paste(): void;
/**
* Executes Edit -> Paste and Match Style in page.
* Executes the editing command pasteAndMatchStyle in web page.
*/
pasteAndMatchStyle(): void;
/**
* Executes Edit -> Delete command in page.
* Executes the editing command delete in web page.
*/
delete(): void;
/**
* Executes Edit -> Select All command in page.
* Executes the editing command selectAll in web page.
*/
selectAll(): void;
/**
* Executes Edit -> Unselect command in page.
* Executes the editing command unselect in web page.
*/
unselect(): void;
/**
* Executes Edit -> Replace command in page.
* Executes the editing command replace in web page.
*/
replace(text: string): void;
/**
* Executes Edit -> Replace Misspelling command in page.
* Executes the editing command replaceMisspelling in web page.
*/
replaceMisspelling(text: string): void;
/**
@@ -4342,7 +4365,7 @@ declare namespace Electron {
wheelTicksY?: number;
accelerationRatioX?: number;
accelerationRatioY?: number;
hasPreciseScrollingDeltas?: number;
hasPreciseScrollingDeltas?: boolean;
canScroll?: boolean;
}
@@ -4619,7 +4642,7 @@ declare namespace Electron {
/**
* Navigates to the specified offset from the "current entry".
*/
goToOffset(offset: boolean): void;
goToOffset(offset: number): void;
/**
* @returns Whether the renderer process has crashed.
*/
@@ -5107,6 +5130,18 @@ interface File {
// https://github.com/electron/electron/blob/master/docs/api/process.md
declare namespace NodeJS {
interface ProcessVersions {
/**
* Electron's version string.
*/
electron: string;
/**
* Chrome's version string.
*/
chrome: string;
}
interface Process {
/**
* Setting this to true can disable the support for asar archives in Node's built-in modules.
+1 -1
View File
@@ -2258,7 +2258,7 @@ function test_PointObject() {
var point = <HighchartsPointObject>$('#container').highcharts().get('point1');
var category = point.category;
var percentage = point.percentage;
point.index;
point.index;
point.remove();
point.remove(false);
point.remove(false, {duration: 50});
+17 -1
View File
@@ -4828,6 +4828,17 @@ interface HighchartsIndividualSeriesOptions {
* that the points and lines can be clicked.
*/
cursor?: string;
/**
* The main color or the series. In line type series it applies to the line and the point markers unless otherwise
* specified. In bar type series it applies to the bars unless a color is specified per point. The default
* value is pulled from the options.colors array.
*/
color?: string;
/**
* You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user
* that the points and lines can be clicked.
*/
cursor?: string;
/**
* An array of data points for the series. For the area series type, points can be given in the following ways:
*
@@ -4883,6 +4894,11 @@ interface HighchartsIndividualSeriesOptions {
* the pointPadding and groupPadding.
*/
pointWidth?: number;
/**
* A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from
* the pointPadding and groupPadding.
*/
pointWidth?: number;
/**
* This option allows grouping series in a stacked chart. The stack option can be a string or a number or anything
* else, as long as the grouped series' stack options match each other.
@@ -6114,7 +6130,7 @@ interface HighchartsPointObject {
*/
category: string | number;
name: string;
index: number;
index: number;
/**
* The percentage for points in a stacked series or pies.
* @since 1.2.0
+12 -10
View File
@@ -301,6 +301,17 @@ declare namespace NodeJS {
heapUsed: number;
}
export interface ProcessVersions {
http_parser: string;
node: string;
v8: string;
ares: string;
uv: string;
zlib: string;
modules: string;
openssl: string;
}
export interface Process extends EventEmitter {
stdout: WritableStream;
stderr: WritableStream;
@@ -320,16 +331,7 @@ declare namespace NodeJS {
setuid(id: number): void;
setuid(id: string): void;
version: string;
versions: {
http_parser: string;
node: string;
v8: string;
ares: string;
uv: string;
zlib: string;
modules: string;
openssl: string;
};
versions: ProcessVersions;
config: {
target_defaults: {
cflags: any[];
+3 -2
View File
@@ -44,7 +44,7 @@ function testProtoBufJs() {
assertIsNamespace(protoFile.ns, "protoFile.ns");
assertIsNamespace(protoFile.ptr, "protoFile.ptr");
assertIsProtoBuf(protoFile.build(), "protoFile.build()");
assertIsMetaMessage<any>(protoFile.build(), "protoFile.build()");
assertIsProtoBuf(protoFile.result, "protoFile.result");
assertIsProtoBuilder(protoFile.create(), "protoFile.create()");
@@ -117,11 +117,12 @@ function assertIsProtoBuf(pb: ProtoBuf.ProtoBuf, name: string) {
}
}
function assertIsMetaMessage(mm: ProtoBuf.MetaMessage, name: string) {
function assertIsMetaMessage<T>(mm: ProtoBuf.MetaMessage<T>, name: string) {
assert.ok("decode" in mm, name + " should contain property decode");
assert.ok("decodeDelimited" in mm, name + " should contain property decodeDelimited");
assert.ok("decode64" in mm, name + " should contain property decode64");
assert.ok("decodeHex" in mm, name + " should contain property decodeHex");
assert.ok("decodeJSON" in mm, name + " should contain property decodeJSON");
}
function assertIsDotProto(dp: ProtoBuf.DotProto, name: string) {
+52 -19
View File
@@ -1,8 +1,9 @@
// Type definitions for ProtoBuf.js
// Type definitions for ProtoBuf.js 5.0.1
// Project: https://github.com/dcodeIO/ProtoBuf.js
// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bytebuffer/bytebuffer.d.ts" />
/// <reference path="../node/node.d.ts" />
declare namespace ProtoBuf {
@@ -10,25 +11,24 @@ declare namespace ProtoBuf {
// protobufjs/src/ProtoBuf.js
var Builder: Builder;
var ByteBuffer: Buffer;
var Long: LongStatic;
var DotProto: DotProto;
var Reflect: Reflect;
var Util: Util;
// var Lang: Lang; TODO: implement interface Lang
// var Util: Util; TODO: implement interface Util
export function loadJson(json: string, builder?: ProtoBuilder,
filename?: string): ProtoBuilder;
export function loadJson(json: string, builder?: ProtoBuilder | string | {},
filename?: string | {}): ProtoBuilder;
export function loadJsonFile(filename: string,
export function loadJsonFile(filename: string | {},
callback?: (error: any, builder: ProtoBuilder) => void,
builder?: ProtoBuilder): ProtoBuilder;
export function loadProto(proto: string, builder?: ProtoBuilder,
filename?: string): ProtoBuilder;
export function loadProto(proto: string, builder?: ProtoBuilder | string | {},
filename?: string | {}): ProtoBuilder;
export function loadProtoFile(filePath: string,
export function loadProtoFile(filePath: string | {},
callback?: (error: any, builder: ProtoBuilder) => void,
builder?: ProtoBuilder): ProtoBuilder;
@@ -117,6 +117,26 @@ declare namespace ProtoBuf {
*/
export interface Message {
new(values?: {[key: string]: any}, var_args?: string[]): Message;
$add(key: string, value: any, noAssert?: boolean): Message;
$get<T>(key: string): T;
$set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void;
add(key: string, value: any, noAssert?: boolean): Message;
calculate(): number;
encode(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer;
encode64(): string;
encodeAB(): ArrayBuffer;
encodeNB(): Buffer;
encodeHex(): string;
encodeJSON(): string;
encodeDelimited(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer;
get<T>(key: string, noAssert?: boolean): T;
set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void;
toArrayBuffer(): ArrayBuffer;
toBase64(): string;
toBuffer(): Buffer;
toHex(): string;
toRaw(binaryAsBase64?: boolean, longsAsStrings?: boolean): {[key: string]: any};
toString(): string;
[field: string]: any;
}
@@ -144,20 +164,22 @@ declare namespace ProtoBuf {
define(pkg: string, options?: {[key: string]: any}): ProtoBuilder;
create(defs?: {[key: string]: any}[]): ProtoBuilder;
resolveAll(): void;
build(path?: string): ProtoBuf;
build(path?: string | [string]): MetaMessage<Message>;
build<T>(path?: string | [string]): MetaMessage<T>;
lookup(path?: string): ReflectT;
}
export interface ProtoBuf {
[package: string]: {[key: string]: MetaMessage | any};
[package: string]: {[key: string]: MetaMessage<Message> | any};
}
export interface MetaMessage {
new(values?: {[key: string]: any}, var_args?: string[]): Message;
decode(buffer?: Buffer, enc?: string): Message;
decodeDelimited(buffer?: Buffer, enc?: string): Message;
decode64(str: string): Message;
decodeHex(str: string): Message;
export interface MetaMessage<T> {
new(values?: {[key: string]: any}, var_args?: string[]): T & Message;
decode(buffer: ArrayBuffer | ByteBuffer | Buffer | string, length?: number | string, enc?: string): T & Message;
decodeDelimited(buffer: ByteBuffer | ArrayBuffer | Buffer | string, enc?: string): T & Message;
decode64(str: string): T & Message;
decodeHex(str: string): T & Message;
decodeJSON(str: string): T & Message;
}
// ==========
@@ -242,6 +264,16 @@ declare namespace ProtoBuf {
options: {[key: string]: any};
}
// ==========
// protobufjs/src/ProtoBuf/Util.js
export interface Util {
IS_NODE: boolean
fetch(path: string, callback?: (data: string) => any): string;
toCamelCase(str: string): string;
XHR(): XMLHttpRequest;
}
// ==========
// protobufjs/src/ProtoBuf/Reflect.js
@@ -288,9 +320,10 @@ declare namespace ProtoBuf {
// new ProtoBuf.Reflect.Message.ExtensionField();
OneOf: ReflectOneOf; // NOTE: only for new ProtoBuf.Reflect.Message.OneOf();
extensions: number[];
clazz(): MetaMessage;
clazz(): MetaMessage<Message>;
isGroup: boolean;
build(rebuild?: boolean): MetaMessage|any;
build(rebuild?: boolean): MetaMessage<Message>|any;
build<T>(rebuild?: boolean): MetaMessage<T>|any;
encode(message: Message, buffer: Buffer, noVerify?: boolean): Buffer;
calculate(message: Message): number;
decode(buffer: Buffer, length?: number, expectedGroupEndId?: number): Message;
+24 -2
View File
@@ -78,14 +78,36 @@ var styles = StyleSheet.create<LocalStyles>(
}
)
//alternative declaration of styles (inline typings)
const stylesAlt = StyleSheet.create(
{
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
} as React.ViewStyle,
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
} as React.TextStyle,
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
} as React.TextStyle
}
)
class Welcome extends React.Component<any,any> {
refs: {
[key: string]: any
rootView: View
}
testNativeMethods() {
// this.setNativeProps({});
+70 -7
View File
@@ -8,9 +8,9 @@
// USING: these definitions are meant to be used with the TSC compiler target set to ES6
//
// USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer
// Warning: the project currently uses and older version of react-native
//
// CONTRIBUTING: please open pull requests and make sure that the changes do not break RNTSExplorer (they should not)
// Do not hesitate to open a pull request against RNTSExplorer to provide an example for a case not covered by the current App
// CONTRIBUTING: please open pull requests
//
// CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie
//
@@ -1339,6 +1339,17 @@ declare namespace __React {
domStorageEnabled?: boolean
}
export interface WebViewIOSLoadRequestEvent {
target: number
canGoBack: boolean
lockIdentifier: number
loading: boolean
title: string
canGoForward: boolean
navigationType: 'other' | 'click'
url: string
}
export interface WebViewPropertiesIOS {
/**
@@ -1368,7 +1379,7 @@ declare namespace __React {
* Return true or false from this method to continue loading the
* request.
*/
onShouldStartLoadWithRequest?: () => boolean
onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => boolean
scrollEnabled?: boolean
}
@@ -1463,12 +1474,12 @@ declare namespace __React {
/**
* view to show if there's an error
*/
renderError?: () => ViewStatic
renderError?: () => React.ReactElement<ViewProperties>
/**
* loading indicator to show
*/
renderLoading?: () => ViewStatic
renderLoading?: () => React.ReactElement<ViewProperties>
scrollEnabled?: boolean
@@ -3313,6 +3324,16 @@ declare namespace __React {
*/
popToTop(): void;
/**
* Replace the previous scene and pop to it.
*/
replacePreviousAndPop( route: Route ): void;
/**
* Navigate to a new scene and reset route stack.
*/
resetTo( route: Route ): void;
}
namespace NavigatorStatic {
@@ -3720,8 +3741,10 @@ declare namespace __React {
export interface PlatformStatic {
OS: PlatformOSType,
// only documented in PlatformSpecificInformation.md
select({PlatformOSType: any}): any
/**
* @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content
*/
select<T>( specifics: { ios?: T, android?: T} ): T;
}
export interface DeviceEventSubscriptionStatic {
@@ -5721,6 +5744,27 @@ declare namespace __React {
handleNavigation( action: NavigationAction ): boolean;
}
//
// Interfacing with Native Modules
// https://facebook.github.io/react-native/docs/native-modules-ios.html
//
export interface NativeEventSubscription {
/**
* Call this method to un-subscribe from a native-event
*/
remove(): void;
}
/**
* Receive events from native-code
* @see https://facebook.github.io/react-native/docs/native-modules-ios.html#sending-events-to-javascript
*/
export interface NativeAppEventEmitterStatic {
addListener(event: string, handler: (data: any) => void): NativeEventSubscription;
}
//////////////////////////////////////////////////////////////////////////
//
// R E - E X P O R T S
@@ -5923,6 +5967,16 @@ declare namespace __React {
export type Easing = EasingStatic;
export var Easing: EasingStatic;
//Native Modules written in ObjectiveC/Swift/Java exposed via the RCTBridge
//See https://facebook.github.io/react-native/docs/native-modules-ios.html
/**
* Use:
* <code>const MyModule = NativeModules.ModuleName</code>
*/
export var NativeModules: any
export var NativeAppEventEmitter: NativeAppEventEmitterStatic
//
// /TODO: BGR: These are leftovers of the initial port that must be revisited
//
@@ -5986,3 +6040,12 @@ declare module "react-native" {
declare var global: __React.GlobalStatic
declare function require( name: string ): any
/**
* This variable is set to true when react-native is running in Dev mode
* Typical usage:
* <code> if (__DEV__) console.log('Running in dev mode')</code>
*/
declare var __DEV__: boolean
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="sleep.d.ts" />
import sleep = require("sleep");
sleep.sleep(1);
sleep.usleep(5000);
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for node-scanf
// Project: https://github.com/ErikDubbelboer/node-sleep
// Definitions by: Jeongho Nam <http://samchon.org>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace __node_sleep
{
/**
* Sleep for <i>n</i> seconds.
*
* @param n Number of seconds to sleep.
*/
function sleep(n: number): void;
/**
* Sleep for n microseconds.
*
* @param n Number of microseconds to sleep; 1 second is 1,000,000 microseconds.
*/
function usleep(n: number): void;
}
declare module "sleep"
{
export = __node_sleep;
}
-4
View File
@@ -1,9 +1,5 @@
/// <reference path="UUID.d.ts" />
import UUID = require("UUID");
const uuid1: string = UUID.generate()
const uuid2: UUID.UUID = UUID.genV4()
const uuid3: UUID.UUID = UUID.genV1()
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Jason Jarrett <https://github.com/staxmanade/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "UUID" {
declare module UUID {
interface UUID {
intFields: UUIDArray<number>;
@@ -36,6 +36,15 @@ window.HTMLImports.whenReady(() => {
document.querySelectorAll(`link[type=${window.HTMLImports.IMPORT_LINK_TYPE}`);
/*
* Shadow DOM
*/
var shadow = xFoo.createShadowRoot();
xFoo.shadowRoot;
shadow.innerHTML;
shadow.host;
/*
* Web Components
*/
+10
View File
@@ -31,6 +31,11 @@ declare namespace webcomponents {
whenReady(callback: () => void): void;
}
export interface ShadowRootPolyfill extends DocumentFragment {
innerHTML: string;
host: Element;
}
export interface Polyfill {
flags: any;
}
@@ -41,6 +46,11 @@ declare module "webcomponents.js" {
export = webcomponents;
}
interface Element {
createShadowRoot(): webcomponents.ShadowRootPolyfill;
shadowRoot?: webcomponents.ShadowRootPolyfill;
}
interface Document {
registerElement(name: string, prototype: webcomponents.CustomElementInit): webcomponents.CustomElementConstructor;
}