Skip to content

Commit 3f01cf1

Browse files
committed
Keep It Simple RequireJS Demo. Shows simple demo of require.js before and after
1 parent 9d89d16 commit 3f01cf1

19 files changed

+2506
-0
lines changed

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
# Ignore Visual Studio Project #
3+
###################
4+
*.user
5+
*.gpState
6+
*.suo
7+
bin*
8+
obj*
9+
/packages
10+
11+
12+
# Compiled source #
13+
###################
14+
*.com
15+
*.class
16+
*.dll
17+
*.exe
18+
*.o
19+
*.so
20+
21+
# Packages #
22+
############
23+
# it's better to unpack these files and commit the raw source
24+
# git has its own built in compression methods
25+
*.7z
26+
*.dmg
27+
*.gz
28+
*.iso
29+
*.jar
30+
*.rar
31+
*.tar
32+
*.xap
33+
*.zip
34+
35+
# Logs and databases #
36+
######################
37+
*.log
38+
*.sql
39+
*.sqlite
40+
*.sdf
41+
42+
# OS generated files #
43+
######################
44+
.DS_Store*
45+
ehthumbs.db
46+
Icon?
47+
Thumbs.db
48+
/CodeCamper.Web/Content/hans_fj
49+
/CodeCamper.Web/Properties/PublishProfiles/Cytanium.pubxml

ModularDemo.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModularDemo", "ModularDemo\ModularDemo.csproj", "{3B596E09-8C54-4C34-9DFE-D4BD84DE8908}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{3B596E09-8C54-4C34-9DFE-D4BD84DE8908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{3B596E09-8C54-4C34-9DFE-D4BD84DE8908}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{3B596E09-8C54-4C34-9DFE-D4BD84DE8908}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{3B596E09-8C54-4C34-9DFE-D4BD84DE8908}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

ModularDemo/ModularDemo.csproj

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProductVersion>
8+
</ProductVersion>
9+
<SchemaVersion>2.0</SchemaVersion>
10+
<ProjectGuid>{3B596E09-8C54-4C34-9DFE-D4BD84DE8908}</ProjectGuid>
11+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<RootNamespace>ModularDemo</RootNamespace>
15+
<AssemblyName>ModularDemo</AssemblyName>
16+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
17+
<UseIISExpress>true</UseIISExpress>
18+
<IISExpressSSLPort />
19+
<IISExpressAnonymousAuthentication />
20+
<IISExpressWindowsAuthentication />
21+
<IISExpressUseClassicPipelineMode />
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
24+
<DebugSymbols>true</DebugSymbols>
25+
<DebugType>full</DebugType>
26+
<Optimize>false</Optimize>
27+
<OutputPath>bin\</OutputPath>
28+
<DefineConstants>DEBUG;TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Web.DynamicData" />
43+
<Reference Include="System.Web.Entity" />
44+
<Reference Include="System.Web.ApplicationServices" />
45+
<Reference Include="System.ComponentModel.DataAnnotations" />
46+
<Reference Include="System" />
47+
<Reference Include="System.Data" />
48+
<Reference Include="System.Core" />
49+
<Reference Include="System.Data.DataSetExtensions" />
50+
<Reference Include="System.Web.Extensions" />
51+
<Reference Include="System.Xml.Linq" />
52+
<Reference Include="System.Drawing" />
53+
<Reference Include="System.Web" />
54+
<Reference Include="System.Xml" />
55+
<Reference Include="System.Configuration" />
56+
<Reference Include="System.Web.Services" />
57+
<Reference Include="System.EnterpriseServices" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Content Include="ScriptsBefore\alerter.js" />
61+
<Content Include="ScriptsBefore\dataservice.js" />
62+
<Content Include="ScriptsBefore\main.js" />
63+
<Content Include="index.before.html" />
64+
<Content Include="index.after.html" />
65+
<Content Include="Require.JS - LICENSE.txt" />
66+
<Content Include="Scripts\alerter.js" />
67+
<Content Include="Scripts\main.js" />
68+
<Content Include="Scripts\dataservice.js" />
69+
<Content Include="Scripts\require.js" />
70+
<Content Include="Web.config" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<Compile Include="Properties\AssemblyInfo.cs" />
74+
</ItemGroup>
75+
<ItemGroup>
76+
<Content Include="packages.config" />
77+
<None Include="Web.Debug.config">
78+
<DependentUpon>Web.config</DependentUpon>
79+
</None>
80+
<None Include="Web.Release.config">
81+
<DependentUpon>Web.config</DependentUpon>
82+
</None>
83+
</ItemGroup>
84+
<PropertyGroup>
85+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
86+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
87+
</PropertyGroup>
88+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
89+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
90+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
91+
<ProjectExtensions>
92+
<VisualStudio>
93+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
94+
<WebProjectProperties>
95+
<UseIIS>True</UseIIS>
96+
<AutoAssignPort>True</AutoAssignPort>
97+
<DevelopmentServerPort>0</DevelopmentServerPort>
98+
<DevelopmentServerVPath>/</DevelopmentServerVPath>
99+
<IISUrl>http://localhost:9871/</IISUrl>
100+
<NTLMAuthentication>False</NTLMAuthentication>
101+
<UseCustomServer>False</UseCustomServer>
102+
<CustomServerUrl>
103+
</CustomServerUrl>
104+
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
105+
</WebProjectProperties>
106+
</FlavorProperties>
107+
</VisualStudio>
108+
</ProjectExtensions>
109+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
110+
Other similar extension points exist, see Microsoft.Common.targets.
111+
<Target Name="BeforeBuild">
112+
</Target>
113+
<Target Name="AfterBuild">
114+
</Target>
115+
-->
116+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("ModularDemo")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("ModularDemo")]
13+
[assembly: AssemblyCopyright("Copyright © 2012")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("f37c3618-88ba-411f-a340-9119b55f5e6d")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
RequireJS is released under two licenses: new BSD, and MIT. You may pick the
2+
license that best suits your development needs. The text of both licenses are
3+
provided below.
4+
5+
6+
The "New" BSD License:
7+
----------------------
8+
9+
Copyright (c) 2010-2011, The Dojo Foundation
10+
All rights reserved.
11+
12+
Redistribution and use in source and binary forms, with or without
13+
modification, are permitted provided that the following conditions are met:
14+
15+
* Redistributions of source code must retain the above copyright notice, this
16+
list of conditions and the following disclaimer.
17+
* Redistributions in binary form must reproduce the above copyright notice,
18+
this list of conditions and the following disclaimer in the documentation
19+
and/or other materials provided with the distribution.
20+
* Neither the name of the Dojo Foundation nor the names of its contributors
21+
may be used to endorse or promote products derived from this software
22+
without specific prior written permission.
23+
24+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
28+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
36+
37+
MIT License
38+
-----------
39+
40+
Copyright (c) 2010-2011, The Dojo Foundation
41+
42+
Permission is hereby granted, free of charge, to any person obtaining a copy
43+
of this software and associated documentation files (the "Software"), to deal
44+
in the Software without restriction, including without limitation the rights
45+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46+
copies of the Software, and to permit persons to whom the Software is
47+
furnished to do so, subject to the following conditions:
48+
49+
The above copyright notice and this permission notice shall be included in
50+
all copies or substantial portions of the Software.
51+
52+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58+
THE SOFTWARE.

ModularDemo/Scripts/alerter.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
define('alerter',
2+
['dataservice'],
3+
function (dataservice) {
4+
5+
var
6+
name = 'John',
7+
showMessage = function () {
8+
var msg = dataservice.getMessage();
9+
alert(msg + ', ' + name);
10+
};
11+
12+
return {
13+
showMessage: showMessage
14+
};
15+
});

ModularDemo/Scripts/dataservice.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
define('dataservice', [],
2+
function () {
3+
var
4+
getMessage = function () {
5+
return 'Welcome to Code Camp';
6+
};
7+
8+
return {
9+
getMessage: getMessage
10+
};
11+
});

ModularDemo/Scripts/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(function () {
2+
3+
requirejs.config( { baseUrl: 'scripts' } );
4+
5+
require(['alerter'],
6+
function (alerter) {
7+
alerter.showMessage();
8+
});
9+
})();

0 commit comments

Comments
 (0)