Skip to content

Commit d54b64e

Browse files
committed
Moving SourceCodeModule that was excluded due to .gitignore.
1 parent 5b668ca commit d54b64e

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

ReactWindows/ReactNative/CoreModulesPackage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using ReactNative.Bridge;
22
using ReactNative.Modules.Core;
3-
using ReactNative.Modules.Debug;
43
using ReactNative.Tracing;
54
using ReactNative.UIManager;
65
using ReactNative.UIManager.Events;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using Newtonsoft.Json.Linq;
2+
using ReactNative.Bridge;
3+
using System.Collections.Generic;
4+
5+
namespace ReactNative.Modules.Core
6+
{
7+
/// <summary>
8+
/// Module that exposes the URL to the source code map (used for exception
9+
/// stack trace parsing) to JavaScript.
10+
/// </summary>
11+
class SourceCodeModule : NativeModuleBase
12+
{
13+
private readonly string _sourceMapUrl;
14+
private readonly string _sourceUrl;
15+
16+
/// <summary>
17+
/// Instantiates the <see cref="SourceCodeModule"/>.
18+
/// </summary>
19+
/// <param name="sourceUrl">The source URL.</param>
20+
/// <param name="sourceMapUrl">The source map URL.</param>
21+
public SourceCodeModule(string sourceUrl, string sourceMapUrl)
22+
{
23+
_sourceMapUrl = sourceMapUrl;
24+
_sourceUrl = sourceUrl;
25+
}
26+
27+
/// <summary>
28+
/// The name of the module.
29+
/// </summary>
30+
public override string Name
31+
{
32+
get
33+
{
34+
return "RCTSourceCode";
35+
}
36+
}
37+
38+
/// <summary>
39+
/// The module constants.
40+
/// </summary>
41+
public override IReadOnlyDictionary<string, object> Constants
42+
{
43+
get
44+
{
45+
return new Dictionary<string, object>
46+
{
47+
{ "scriptURL", _sourceUrl },
48+
};
49+
}
50+
}
51+
52+
/// <summary>
53+
/// Gets the script mapping URL.
54+
/// </summary>
55+
/// <param name="promise">The promise.</param>
56+
[ReactMethod]
57+
public void getScriptText(IPromise promise)
58+
{
59+
var map = new JObject
60+
{
61+
{ "fullSourceMappingURL", _sourceMapUrl },
62+
};
63+
64+
promise.Resolve(map);
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)