feat(hmr): preserve navigation history on applying changes (#7146)

This commit is contained in:
Vasil Chimev
2019-04-23 17:47:29 +03:00
committed by GitHub
parent 4e56c89f7d
commit d35e14ed0f
23 changed files with 414 additions and 168 deletions

View File

@@ -28,6 +28,11 @@ export function convertString(value: any): any {
return result;
}
export function getModuleName(path: string): string {
let moduleName = path.replace("./", "");
return moduleName.substring(0, moduleName.lastIndexOf("."));
}
export module layout {
const MODE_SHIFT = 30;
const MODE_MASK = 0x3 << MODE_SHIFT;
@@ -148,4 +153,4 @@ export function hasDuplicates(arr: Array<any>): boolean {
export function eliminateDuplicates(arr: Array<any>): Array<any> {
return Array.from(new Set(arr));
}
}

View File

@@ -185,13 +185,13 @@ export module ad {
export module ios {
/**
* @deprecated use the respective native property directly
*
*
* Checks if the property is a function and if it is, calls it on this.
* Designed to support backward compatibility for methods that became properties.
* Will not work on delegates since it checks if the propertyValue is a function, and delegates are marshalled as functions.
* Example: getter(NSRunLoop, NSRunLoop.currentRunLoop).runUntilDate(NSDate.dateWithTimeIntervalSinceNow(waitTime));
*/
export function getter<T>(_this: any, propertyValue: T | {(): T}): T;
export function getter<T>(_this: any, propertyValue: T | { (): T }): T;
// Common properties between UILabel, UITextView and UITextField
export interface TextUIView {
@@ -255,7 +255,7 @@ export module ios {
* @param rootViewController The root UIViewController instance to start searching from (normally window.rootViewController).
* Returns the visible UIViewController.
*/
export function getVisibleViewController(rootViewController: any/* UIViewController*/ ): any/* UIViewController*/;
export function getVisibleViewController(rootViewController: any/* UIViewController*/): any/* UIViewController*/;
}
/**
@@ -305,6 +305,12 @@ export function escapeRegexSymbols(source: string): string
*/
export function convertString(value: any): any
/**
* Gets module name from path.
* @param path The module path.
*/
export function getModuleName(path: string): string
/**
* Sorts an array by using merge sort algorithm (which ensures stable sort since the built-in Array.sort() does not promise a stable sort).
* @param arr - array to be sorted