From 0bc724912c1b2913e40ed0697768d7e5b7d99003 Mon Sep 17 00:00:00 2001 From: David Berry Date: Sun, 16 Aug 2015 12:45:04 -0600 Subject: [PATCH 1/3] Combined xrm and clientglobalcontext definitions Pushed the clientglobalcontext.d.ts definitions into the main xrm.d.ts (and associated version branches), to eliminate the need for manually adjusting it to select the correct version, via its header. This was simply a bad design choice on my part. Care should be taken, though, to avoid using the "GetGlobalContext" method without having first added ClientGlobalContext.js.aspx to the script sources of the page--as always. --- xrm/clientglobalcontext.d.ts | 14 -------------- xrm/xrm-6.d.ts | 8 ++++++++ xrm/xrm-7.0.d.ts | 8 ++++++++ xrm/xrm.d.ts | 8 ++++++++ 4 files changed, 24 insertions(+), 14 deletions(-) delete mode 100644 xrm/clientglobalcontext.d.ts diff --git a/xrm/clientglobalcontext.d.ts b/xrm/clientglobalcontext.d.ts deleted file mode 100644 index ae7bcc219..000000000 --- a/xrm/clientglobalcontext.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Type definitions for Microsoft Dynamics xRM ClientGlobalContext.js.aspx -// Project: http://msdn.microsoft.com/en-us/library/gg328255.aspx -// Definitions by: David Berry -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -/** - * Gets the xRM application context, for HTML web resources - * @returns {Xrm.Context} The application context for the user's current session. - * @remarks The ClientGlobalContext.js.aspx page will include some global event handlers. These event handlers will - * cancel the onselectstart, contextmenu, and ondragstart events. - */ -declare function GetGlobalContext(): Xrm.Context; \ No newline at end of file diff --git a/xrm/xrm-6.d.ts b/xrm/xrm-6.d.ts index f2a88eb44..017763803 100644 --- a/xrm/xrm-6.d.ts +++ b/xrm/xrm-6.d.ts @@ -2069,3 +2069,11 @@ declare module Xrm export function openWebResource( webResourceName: string, webResourceData?: string, width?: number, height?: number ): Window; } } + +/** + * Gets the xRM application context, for HTML web resources, included by ClientGlobalContext.js.aspx + * @returns {Xrm.Context} The application context for the user's current session. + * @remarks The ClientGlobalContext.js.aspx page will include some global event handlers. These event handlers will + * cancel the onselectstart, contextmenu, and ondragstart events. + */ +declare function GetGlobalContext(): Xrm.Context; diff --git a/xrm/xrm-7.0.d.ts b/xrm/xrm-7.0.d.ts index 42814382d..c098759cb 100644 --- a/xrm/xrm-7.0.d.ts +++ b/xrm/xrm-7.0.d.ts @@ -2348,3 +2348,11 @@ declare module Xrm export function openWebResource( webResourceName: string, webResourceData?: string, width?: number, height?: number ): Window; } } + +/** + * Gets the xRM application context, for HTML web resources, included by ClientGlobalContext.js.aspx + * @returns {Xrm.Context} The application context for the user's current session. + * @remarks The ClientGlobalContext.js.aspx page will include some global event handlers. These event handlers will + * cancel the onselectstart, contextmenu, and ondragstart events. + */ +declare function GetGlobalContext(): Xrm.Context; diff --git a/xrm/xrm.d.ts b/xrm/xrm.d.ts index 8b82136a4..b3848f108 100644 --- a/xrm/xrm.d.ts +++ b/xrm/xrm.d.ts @@ -2584,3 +2584,11 @@ declare module Xrm export function openWebResource( webResourceName: string, webResourceData?: string, width?: number, height?: number ): Window; } } + +/** + * Gets the xRM application context, for HTML web resources, included by ClientGlobalContext.js.aspx + * @returns {Xrm.Context} The application context for the user's current session. + * @remarks The ClientGlobalContext.js.aspx page will include some global event handlers. These event handlers will + * cancel the onselectstart, contextmenu, and ondragstart events. + */ +declare function GetGlobalContext(): Xrm.Context; From a7c664b54b64abb1598352333488926afe27e8b4 Mon Sep 17 00:00:00 2001 From: David Berry Date: Sun, 16 Aug 2015 12:51:31 -0600 Subject: [PATCH 2/3] Removed invalid test reference After last refactor, test references needed adjustment to remove clientglobalcontext.d.ts. --- xrm/xrm-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/xrm/xrm-tests.ts b/xrm/xrm-tests.ts index 610662c7d..50fd36955 100644 --- a/xrm/xrm-tests.ts +++ b/xrm/xrm-tests.ts @@ -1,5 +1,4 @@ /// -/// /// /// Demonstrate clientglobalcontext.d.ts From 0aa7dc2a0f2f585c34be4ab33d17a181c1628410 Mon Sep 17 00:00:00 2001 From: David Berry Date: Sun, 16 Aug 2015 12:54:12 -0600 Subject: [PATCH 3/3] Updated version-branch tests. After refactor to eliminate the clientglobalcontext.d.ts file, the tests needed an update to their reference headers. --- xrm/xrm-6.tests.ts | 1 - xrm/xrm-7.0.tests.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/xrm/xrm-6.tests.ts b/xrm/xrm-6.tests.ts index a791d861e..26f467b5b 100644 --- a/xrm/xrm-6.tests.ts +++ b/xrm/xrm-6.tests.ts @@ -1,5 +1,4 @@ /// -/// function _getContext() { diff --git a/xrm/xrm-7.0.tests.ts b/xrm/xrm-7.0.tests.ts index cb648e585..dc93ae237 100644 --- a/xrm/xrm-7.0.tests.ts +++ b/xrm/xrm-7.0.tests.ts @@ -1,5 +1,4 @@ /// -/// function _getContext() {