Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix #40, change the way messages are queued for the SignalR connection

  • Loading branch information...
commit 248d80886ae502f391c56d8e90d8784bd74fb91f 1 parent f7e3a31
@jrusbatch authored
Showing with 38 additions and 11 deletions.
  1. +3 −1 .gitignore
  2. +24 −9 Web/Assets/js/compilify.js
  3. +11 −1 Web/Web.csproj
View
4 .gitignore
@@ -12,4 +12,6 @@ _ReSharper.*
*.resharper
packages/
*.ncrunchsolution
-*.DotSettings
+*.DotSettings
+UpgradeLog*.xml
+_Upgrade*
View
33 Web/Assets/js/compilify.js
@@ -20,12 +20,22 @@
var timer,
isConnected = false,
+ messageQueue = [],
conn = $.connection(url),
opts = _.defaults(options, {
timeout: 30000,
onReceived: $.noop
});
-
+
+ function onStarted() {
+ var next;
+ while ((next = messageQueue.shift()) !== undefined) {
+ conn.send(next);
+ }
+
+ isConnected = true;
+ }
+
function onTimeout() {
conn.stop();
isConnected = false;
@@ -42,6 +52,10 @@
});
conn.received(opts.onReceived);
+
+ conn.reconnected(function() {
+ console.log("Reconnected!");
+ });
return {
send: function (data) {
@@ -49,10 +63,8 @@
conn.send(data);
}
else {
- conn.start(function() {
- isConnected = true;
- conn.send(data);
- });
+ messageQueue.push(data);
+ conn.start(onStarted);
}
}
};
@@ -111,14 +123,17 @@
for (var index in msg.data) {
var error = msg.data[index];
+ var loc = error.Location;
- var start = error.Location.StartLinePosition;
- var end = error.Location.EndLinePosition;
+ var file = loc.FileName;
+
+ var start = loc.StartLinePosition;
+ var end = loc.EndLinePosition;
var markStart = { line: start.Line, ch: start.Character };
var markEnd = { line: end.Line, ch: end.Character };
-
- var mark = Compilify[error.Location.FileName].markText(markStart, markEnd, 'compilation-error');
+
+ var mark = Compilify[file].markText(markStart, markEnd, 'compilation-error');
markedErrors.push(mark);
View
12 Web/Web.csproj
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -18,6 +19,10 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<JSLintSkip>\Assets\js\vendor\</JSLintSkip>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>4.0</OldToolsVersion>
+ <UpgradeBackupLocation />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -295,8 +300,13 @@
<Name>Core</Name>
</ProjectReference>
</ItemGroup>
+ <PropertyGroup>
+ <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Please sign in to comment.
Something went wrong with that request. Please try again.