mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Added merge_module function. Added text module (currently having encoding only). Updated the FileSystem File object with readText, writeText methods (removed the FileReader, FileWriter classes).
This commit is contained in:
@ -1,11 +1,10 @@
|
|||||||
import app_common_module = require("Application/application_common");
|
import app_common_module = require("Application/application_common");
|
||||||
var currentApp = app_common_module.Application.current;
|
|
||||||
|
|
||||||
// merge the exports of the application_common file with the exports of this file
|
// merge the exports of the application_common file with the exports of this file
|
||||||
declare var exports;
|
declare var exports;
|
||||||
exports.TargetOS = app_common_module.TargetOS;
|
require("Utils/module_merge").merge(app_common_module, exports);
|
||||||
exports.Application = app_common_module.Application;
|
|
||||||
|
|
||||||
|
var currentApp = app_common_module.Application.current;
|
||||||
var callbacks = android.app.Application.ActivityLifecycleCallbacks;
|
var callbacks = android.app.Application.ActivityLifecycleCallbacks;
|
||||||
|
|
||||||
var initEvents = function () {
|
var initEvents = function () {
|
||||||
|
@ -21,12 +21,12 @@ log("JavaScript loading ended.");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import app_common_module = require("Application/application_common");
|
import app_common_module = require("Application/application_common");
|
||||||
var currentApp = app_common_module.Application.current;
|
|
||||||
|
|
||||||
// merge the exports of the application_common file with the exports of this file
|
// merge the exports of the application_common file with the exports of this file
|
||||||
declare var exports;
|
declare var exports;
|
||||||
exports.TargetOS = app_common_module.TargetOS;
|
require("Utils/module_merge").merge(app_common_module, exports);
|
||||||
exports.Application = app_common_module.Application;
|
|
||||||
|
var currentApp = app_common_module.Application.current;
|
||||||
|
|
||||||
// TODO: Declarations
|
// TODO: Declarations
|
||||||
export var init = function (nativeApp: any) {
|
export var init = function (nativeApp: any) {
|
||||||
|
@ -119,6 +119,14 @@
|
|||||||
<TypeScriptCompile Include="Location\location_types.ts">
|
<TypeScriptCompile Include="Location\location_types.ts">
|
||||||
<DependentUpon>location.d.ts</DependentUpon>
|
<DependentUpon>location.d.ts</DependentUpon>
|
||||||
</TypeScriptCompile>
|
</TypeScriptCompile>
|
||||||
|
<TypeScriptCompile Include="text\index.ts" />
|
||||||
|
<TypeScriptCompile Include="text\text.android.ts">
|
||||||
|
<DependentUpon>text.d.ts</DependentUpon>
|
||||||
|
</TypeScriptCompile>
|
||||||
|
<TypeScriptCompile Include="text\text.d.ts" />
|
||||||
|
<TypeScriptCompile Include="text\text.ios.ts">
|
||||||
|
<DependentUpon>text.d.ts</DependentUpon>
|
||||||
|
</TypeScriptCompile>
|
||||||
<TypeScriptCompile Include="UserPreferences\user_preferences.android.ts">
|
<TypeScriptCompile Include="UserPreferences\user_preferences.android.ts">
|
||||||
<DependentUpon>user_preferences.d.ts</DependentUpon>
|
<DependentUpon>user_preferences.d.ts</DependentUpon>
|
||||||
</TypeScriptCompile>
|
</TypeScriptCompile>
|
||||||
@ -126,6 +134,7 @@
|
|||||||
<TypeScriptCompile Include="UserPreferences\user_preferences.ios.ts">
|
<TypeScriptCompile Include="UserPreferences\user_preferences.ios.ts">
|
||||||
<DependentUpon>user_preferences.d.ts</DependentUpon>
|
<DependentUpon>user_preferences.d.ts</DependentUpon>
|
||||||
</TypeScriptCompile>
|
</TypeScriptCompile>
|
||||||
|
<TypeScriptCompile Include="Utils\module_merge.ts" />
|
||||||
<TypeScriptCompile Include="Utils\utils_android.ts" />
|
<TypeScriptCompile Include="Utils\utils_android.ts" />
|
||||||
<TypeScriptCompile Include="Utils\utils_ios.ts" />
|
<TypeScriptCompile Include="Utils\utils_ios.ts" />
|
||||||
<TypeScriptCompile Include="http\http_request.android.ts">
|
<TypeScriptCompile Include="http\http_request.android.ts">
|
||||||
|
74
FileSystem/file_system.d.ts
vendored
74
FileSystem/file_system.d.ts
vendored
@ -52,14 +52,14 @@ export declare class File extends FileSystemEntity {
|
|||||||
public static fromPath(path: string, onError?: (error: any) => any): File;
|
public static fromPath(path: string, onError?: (error: any) => any): File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a FileReader object over this file and locks the file until the reader is released.
|
* Reads the content of the file as a string using the specified encoding (defaults to UTF-8).
|
||||||
*/
|
*/
|
||||||
public openRead(): FileReader;
|
public readText(onSuccess: (content: string) => any, onError?: (error: any) => any, encoding?: string);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a FileWriter object over this file and locks the file until the writer is released.
|
* Writes the provided string to the file, using the specified encoding (defaults to UTF-8).
|
||||||
*/
|
*/
|
||||||
public openWrite(): FileWriter;
|
public writeText(content: string, onSuccess?: () => any, onError?: (error: any) => any, encoding?: string);
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare class Folder extends FileSystemEntity {
|
export declare class Folder extends FileSystemEntity {
|
||||||
@ -110,7 +110,7 @@ export declare class Folder extends FileSystemEntity {
|
|||||||
If the callback returns false this will mean for the iteration to stop.
|
If the callback returns false this will mean for the iteration to stop.
|
||||||
*/
|
*/
|
||||||
public eachEntity(onEntity: (entity: FileSystemEntity) => boolean, onError?: (error: any) => any);
|
public eachEntity(onEntity: (entity: FileSystemEntity) => boolean, onError?: (error: any) => any);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
|
* Provides access to the top-level Folders instances that are accessible from the application. Use these as entry points to access the FileSystem.
|
||||||
@ -127,39 +127,39 @@ export declare module knownFolders {
|
|||||||
export function temp(): Folder;
|
export function temp(): Folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* Base class for FileReader and FileWriter APIs.
|
// * Base class for FileReader and FileWriter APIs.
|
||||||
*/
|
// */
|
||||||
export declare class FileAccess {
|
//export declare class FileAccess {
|
||||||
constructor(file: File);
|
// constructor(file: File);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Unlocks the file and allows other operations over it.
|
// * Unlocks the file and allows other operations over it.
|
||||||
*/
|
// */
|
||||||
public release();
|
// public release();
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the underlying File instance.
|
// * Gets the underlying File instance.
|
||||||
*/
|
// */
|
||||||
file: File;
|
// file: File;
|
||||||
}
|
//}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* Enables reading the content of a File entity.
|
// * Enables reading the content of a File entity.
|
||||||
*/
|
// */
|
||||||
export declare class FileReader extends FileAccess {
|
//export declare class FileReader extends FileAccess {
|
||||||
/**
|
///**
|
||||||
* Reads the content of the underlying File as a UTF8 encoded string.
|
//* Reads the content of the underlying File as a UTF8 encoded string.
|
||||||
*/
|
//*/
|
||||||
public readText(onSuccess: (content: string) => any, onError?: (error: any) => any);
|
//public readText(onSuccess: (content: string) => any, onError?: (error: any) => any);
|
||||||
}
|
//}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* Enables saving data to a File entity.
|
// * Enables saving data to a File entity.
|
||||||
*/
|
// */
|
||||||
export declare class FileWriter extends FileAccess {
|
//export declare class FileWriter extends FileAccess {
|
||||||
/**
|
// /**
|
||||||
* Enables saving string to a File entity.
|
// * Enables saving string to a File entity.
|
||||||
*/
|
// */
|
||||||
public writeText(content: string, onSuccess?: () => any, onError?: (error: any) => any);
|
// public writeText(content: string, onSuccess?: () => any, onError?: (error: any) => any);
|
||||||
}
|
//}
|
@ -162,31 +162,15 @@ export class File extends FileSystemEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a File with the specified path already exists.
|
* Checks whether a File with the specified path already exists.
|
||||||
*/
|
*/
|
||||||
public static exists(path: string): boolean {
|
public static exists(path: string): boolean {
|
||||||
return getFileAccess().fileExists(path);
|
return getFileAccess().fileExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a FileReader object over this file and locks the file until the reader is released.
|
* Gets the extension of the entity.
|
||||||
*/
|
*/
|
||||||
public openRead(): FileReader {
|
|
||||||
this.checkAccess();
|
|
||||||
return new FileReader(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a FileWriter object over this file and locks the file until the writer is released.
|
|
||||||
*/
|
|
||||||
public openWrite(): FileWriter {
|
|
||||||
this.checkAccess();
|
|
||||||
return new FileWriter(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the extension of the entity.
|
|
||||||
*/
|
|
||||||
get extension(): string {
|
get extension(): string {
|
||||||
return this[extensionProperty];
|
return this[extensionProperty];
|
||||||
}
|
}
|
||||||
@ -198,11 +182,63 @@ export class File extends FileSystemEntity {
|
|||||||
return this[fileLockedProperty];
|
return this[fileLockedProperty];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the content of the file as a string using the specified encoding (defaults to UTF-8).
|
||||||
|
*/
|
||||||
|
public readText(onSuccess: (content: string) => any, onError?: (error: any) => any, encoding?: string) {
|
||||||
|
if (!onSuccess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.checkAccess();
|
||||||
|
this[fileLockedProperty] = true;
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
var localSuccess = function (content: string) {
|
||||||
|
that[fileLockedProperty] = false;
|
||||||
|
onSuccess(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
var localError = function (error) {
|
||||||
|
that[fileLockedProperty] = false;
|
||||||
|
if (onError) {
|
||||||
|
onError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Asyncronous
|
||||||
|
getFileAccess().readText(this.path, localSuccess, localError, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the provided string to the file, using the specified encoding. Any previous content will be overwritten.
|
||||||
|
*/
|
||||||
|
public writeText(content: string, onSuccess?: () => any, onError?: (error: any) => any, encoding?: string) {
|
||||||
|
this.checkAccess();
|
||||||
|
this[fileLockedProperty] = true;
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
var localSuccess = function () {
|
||||||
|
that[fileLockedProperty] = false;
|
||||||
|
if (onSuccess) {
|
||||||
|
onSuccess();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var localError = function (error) {
|
||||||
|
that[fileLockedProperty] = false;
|
||||||
|
if (onError) {
|
||||||
|
onError(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: Asyncronous
|
||||||
|
getFileAccess().writeText(this.path, content, localSuccess, localError, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
private checkAccess() {
|
private checkAccess() {
|
||||||
if (this.isLocked) {
|
if (this.isLocked) {
|
||||||
throw {
|
throw new Error("Cannot access a locked file.");
|
||||||
message: "Cannot access a locked file."
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,52 +407,4 @@ export module knownFolders {
|
|||||||
|
|
||||||
return _temp;
|
return _temp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for FileReader and FileWriter APIs.
|
|
||||||
*/
|
|
||||||
export class FileAccess {
|
|
||||||
private _file;
|
|
||||||
|
|
||||||
constructor(file: File) {
|
|
||||||
this._file = file;
|
|
||||||
this._file[fileLockedProperty] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlocks the file and allows other operations over it.
|
|
||||||
*/
|
|
||||||
public release() {
|
|
||||||
this._file[fileLockedProperty] = false;
|
|
||||||
this._file = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the underlying File instance.
|
|
||||||
*/
|
|
||||||
get file(): File {
|
|
||||||
return this._file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables reading the content of a File entity.
|
|
||||||
*/
|
|
||||||
export class FileReader extends FileAccess {
|
|
||||||
/**
|
|
||||||
* Reads the content of the underlying File as a UTF8 encoded string.
|
|
||||||
*/
|
|
||||||
public readText(onSuccess: (content: string) => any, onError?: (error: any) => any) {
|
|
||||||
getFileAccess().readText(this.file.path, onSuccess, onError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables saving data to a File entity.
|
|
||||||
*/
|
|
||||||
export class FileWriter extends FileAccess {
|
|
||||||
public writeText(content: string, onSuccess?: () => any, onError?: (error: any) => any) {
|
|
||||||
getFileAccess().writeText(this.file.path, content, onSuccess, onError);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
import app_module = require("Application/application");
|
import appModule = require("Application/application");
|
||||||
|
import textModule = require("text/text");
|
||||||
|
|
||||||
export class FileSystemAccess {
|
export class FileSystemAccess {
|
||||||
private _encoding = "UTF-8";
|
|
||||||
private _pathSeparator = java.io.File.separator;
|
private _pathSeparator = java.io.File.separator;
|
||||||
|
|
||||||
public getLastModified(path: string): Date {
|
public getLastModified(path: string): Date {
|
||||||
@ -212,22 +211,27 @@ export class FileSystemAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getDocumentsFolderPath(): string {
|
public getDocumentsFolderPath(): string {
|
||||||
var context = app_module.Application.current.android.context;
|
var context = appModule.Application.current.android.context;
|
||||||
var dir: java.io.File = context.getFilesDir();
|
var dir = context.getFilesDir();
|
||||||
return dir.getAbsolutePath();
|
return dir.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTempFolderPath(): string {
|
public getTempFolderPath(): string {
|
||||||
var context = app_module.Application.current.android.context;
|
var context = appModule.Application.current.android.context;
|
||||||
var dir: java.io.File = context.getCacheDir();
|
var dir = context.getCacheDir();
|
||||||
return dir.getAbsolutePath();
|
return dir.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public readText(path: string, onSuccess: (content: string) => any, onError?: (error: any) => any) {
|
public readText(path: string, onSuccess: (content: string) => any, onError?: (error: any) => any, encoding?: string) {
|
||||||
try {
|
try {
|
||||||
var javaFile = new java.io.File(path);
|
var javaFile = new java.io.File(path);
|
||||||
var stream = new java.io.FileInputStream(javaFile);
|
var stream = new java.io.FileInputStream(javaFile);
|
||||||
var reader = new java.io.InputStreamReader(stream, this._encoding);
|
|
||||||
|
var actualEncoding = encoding;
|
||||||
|
if (!actualEncoding) {
|
||||||
|
actualEncoding = textModule.encoding.UTF_8;
|
||||||
|
}
|
||||||
|
var reader = new java.io.InputStreamReader(stream, actualEncoding);
|
||||||
var bufferedReader = new java.io.BufferedReader(reader);
|
var bufferedReader = new java.io.BufferedReader(reader);
|
||||||
|
|
||||||
// TODO: We will need to read the entire file to a CharBuffer instead of reading it line by line
|
// TODO: We will need to read the entire file to a CharBuffer instead of reading it line by line
|
||||||
@ -243,8 +247,9 @@ export class FileSystemAccess {
|
|||||||
if (result.length > 0) {
|
if (result.length > 0) {
|
||||||
// add the new line manually to the result
|
// add the new line manually to the result
|
||||||
// TODO: Try with CharBuffer at a later stage, when the Bridge allows it
|
// TODO: Try with CharBuffer at a later stage, when the Bridge allows it
|
||||||
// result += "\n";
|
result += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
result += line;
|
result += line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,15 +265,20 @@ export class FileSystemAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public writeText(path: string, content: string, onSuccess?: () => any, onError?: (error: any) => any) {
|
public writeText(path: string, content: string, onSuccess?: () => any, onError?: (error: any) => any, encoding?: string) {
|
||||||
try {
|
try {
|
||||||
var javaFile = new java.io.File(path);
|
var javaFile = new java.io.File(path);
|
||||||
var stream = new java.io.FileOutputStream(javaFile);
|
var stream = new java.io.FileOutputStream(javaFile);
|
||||||
var writer = new java.io.OutputStreamWriter(stream, this._encoding);
|
|
||||||
|
var actualEncoding = encoding;
|
||||||
|
if (!actualEncoding) {
|
||||||
|
actualEncoding = textModule.encoding.UTF_8;
|
||||||
|
}
|
||||||
|
var writer = new java.io.OutputStreamWriter(stream, actualEncoding);
|
||||||
|
|
||||||
writer.write(content);
|
writer.write(content);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
if (onSuccess) {
|
if (onSuccess) {
|
||||||
onSuccess();
|
onSuccess();
|
||||||
}
|
}
|
||||||
|
6
FileSystem/file_system_access.d.ts
vendored
6
FileSystem/file_system_access.d.ts
vendored
@ -20,8 +20,10 @@ export declare class FileSystemAccess {
|
|||||||
rename(path: string, newPath: string, onSuccess?: () => any, onError?: (error: any) => any): void;
|
rename(path: string, newPath: string, onSuccess?: () => any, onError?: (error: any) => any): void;
|
||||||
getDocumentsFolderPath(): string;
|
getDocumentsFolderPath(): string;
|
||||||
getTempFolderPath(): string;
|
getTempFolderPath(): string;
|
||||||
readText(path: string, onSuccess: (content: string) => any, onError?: (error: any) => any);
|
|
||||||
writeText(path: string, content: string, onSuccess?: () => any, onError?: (error: any) => any);
|
readText(path: string, onSuccess: (content: string) => any, onError?: (error: any) => any, encoding?: string);
|
||||||
|
writeText(path: string, content: string, onSuccess?: () => any, onError?: (error: any) => any, encoding?: string);
|
||||||
|
|
||||||
getFileExtension(path: string): string;
|
getFileExtension(path: string): string;
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
|||||||
import app_module = require("Application/application");
|
import app_module = require("Application/application");
|
||||||
import utilsModule = require("Utils/utils_ios");
|
import utilsModule = require("Utils/utils_ios");
|
||||||
|
import textModule = require("text/text");
|
||||||
|
|
||||||
// TODO: Implement all the APIs receiving callback using async blocks
|
// TODO: Implement all the APIs receiving callback using async blocks
|
||||||
// TODO: Check whether we need try/catch blocks for the iOS implementation
|
// TODO: Check whether we need try/catch blocks for the iOS implementation
|
||||||
@ -225,8 +226,13 @@ export class FileSystemAccess {
|
|||||||
return this.getKnownPath(this.cachesDir);
|
return this.getKnownPath(this.cachesDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
public readText(path: string, onSuccess: (content: string) => any, onError?: (error: any) => any) {
|
public readText(path: string, onSuccess: (content: string) => any, onError?: (error: any) => any, encoding?: string) {
|
||||||
var nsString = Foundation.NSString.stringWithContentsOfFileEncodingError(path, this.NSUTF8StringEncoding, null);
|
var actualEncoding = encoding;
|
||||||
|
if (!actualEncoding) {
|
||||||
|
actualEncoding = textModule.encoding.UTF_8;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nsString = Foundation.NSString.stringWithContentsOfFileEncodingError(path, actualEncoding, null);
|
||||||
if (!nsString) {
|
if (!nsString) {
|
||||||
if (onError) {
|
if (onError) {
|
||||||
onError(new Error("Failed to read file at path '" + path + "'"));
|
onError(new Error("Failed to read file at path '" + path + "'"));
|
||||||
@ -236,11 +242,16 @@ export class FileSystemAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public writeText(path: string, content: string, onSuccess?: () => any, onError?: (error: any) => any) {
|
public writeText(path: string, content: string, onSuccess?: () => any, onError?: (error: any) => any, encoding?: string) {
|
||||||
var nsString = Foundation.NSString.initWithString(content);
|
var nsString = Foundation.NSString.initWithString(content);
|
||||||
|
|
||||||
|
var actualEncoding = encoding;
|
||||||
|
if (!actualEncoding) {
|
||||||
|
actualEncoding = textModule.encoding.UTF_8;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: verify the useAuxiliaryFile parameter should be false
|
// TODO: verify the useAuxiliaryFile parameter should be false
|
||||||
if (!nsString.writeToFileAtomicallyEncodingError(path, false, this.NSUTF8StringEncoding, null)) {
|
if (!nsString.writeToFileAtomicallyEncodingError(path, false, actualEncoding, null)) {
|
||||||
if (onError) {
|
if (onError) {
|
||||||
onError(new Error("Failed to write to file '" + path + "'"));
|
onError(new Error("Failed to write to file '" + path + "'"));
|
||||||
}
|
}
|
||||||
|
7
Utils/module_merge.ts
Normal file
7
Utils/module_merge.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
|
||||||
|
// Note: the method will not check for naming collisions and will override any already existing entries in the destination exports.
|
||||||
|
export var merge = function (sourceExports: any, destExports: any) {
|
||||||
|
for (var key in sourceExports) {
|
||||||
|
destExports[key] = sourceExports[key];
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ import http = require("http/http_request");
|
|||||||
|
|
||||||
// merge request
|
// merge request
|
||||||
declare var exports;
|
declare var exports;
|
||||||
exports.request = http.request;
|
require("Utils/module_merge").merge(http, exports);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets string from url.
|
* Gets string from url.
|
||||||
|
2
text/index.ts
Normal file
2
text/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
declare var module, require;
|
||||||
|
module.exports = require("text/text");
|
8
text/text.android.ts
Normal file
8
text/text.android.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export module encoding {
|
||||||
|
export var ISO_8859_1 = "ISO-8859-1";
|
||||||
|
export var US_ASCII = "US-ASCII";
|
||||||
|
export var UTF_16 = "UTF-16";
|
||||||
|
export var UTF_16BE = "UTF-16BE";
|
||||||
|
export var UTF_16LE = "UTF-16LE";
|
||||||
|
export var UTF_8 = "UTF-8";
|
||||||
|
}
|
11
text/text.d.ts
vendored
Normal file
11
text/text.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Defines the supported character encodings.
|
||||||
|
*/
|
||||||
|
export declare module encoding {
|
||||||
|
export var ISO_8859_1: any;
|
||||||
|
export var US_ASCII: any;
|
||||||
|
export var UTF_16: any;
|
||||||
|
export var UTF_16BE: any;
|
||||||
|
export var UTF_16LE: any;
|
||||||
|
export var UTF_8: any;
|
||||||
|
}
|
8
text/text.ios.ts
Normal file
8
text/text.ios.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export module encoding {
|
||||||
|
export var ISO_8859_1 = 5; //NSISOLatin1StringEncoding
|
||||||
|
export var US_ASCII = 1; //NSASCIIStringEncoding
|
||||||
|
export var UTF_16 = 10; //NSUnicodeStringEncoding
|
||||||
|
export var UTF_16BE = 0x90000100; //NSUTF16BigEndianStringEncoding
|
||||||
|
export var UTF_16LE = 0x94000100; //NSUTF16LittleEndianStringEncoding
|
||||||
|
export var UTF_8 = 4; //NSUTF8StringEncoding
|
||||||
|
}
|
Reference in New Issue
Block a user