Skip to content

Commit

Permalink
browser must now use window.MitchAllen.ConnectionGrid, updated exampl…
Browse files Browse the repository at this point in the history
…es and doc
  • Loading branch information
Mitch Allen committed Dec 23, 2016
1 parent 5468838 commit 31a8b18
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 4,274 deletions.
12 changes: 4 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,16 @@ module.exports = function (grunt) {
dist: {
options: {
browserifyOptions: {
standalone: 'ConnectionGrid'
standalone: 'MitchAllen.ConnectionGrid'
},
transform: [['babelify', {presets: ['es2015']}]]
transform: [['babelify', {presets: ['es2015']}]],
plugin: [[ "browserify-derequire" ]]
},
files: {
// if the source file has an extension of es6 then
// we change the name of the source file accordingly.
// The result file's extension is always .js
"./dist/connection-grid.js": ["./modules/index.js"],
"./dist/base.js": ["./modules/base.js"],
"./dist/square.js": ["./modules/square.js"],
"./dist/circle.js": ["./modules/circle.js"],
"./dist/hexagon.js": ["./modules/hexagon.js"],
"./dist/triangle.js": ["./modules/triangle.js"]
"./dist/connection-grid.js": ["./modules/index.js"]
}
}
},
Expand Down
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,58 @@ You must use __npm__ __2.7.0__ or higher because of the scoped package name.
let ySize = 6;

var grid = gridFactory.Square({ x: xSize, y: ySize });

## Browser Usage:

You can reference a minimized client version inside an HTML script tag using one of these URL's:

* https://cdn.rawgit.com/mitchallen/connection-grid/v0.1.25/dist/connection-grid.min.js
* https://unpkg.com/@mitchallen/connection-grid@0.1.25/dist/connection-grid.min.js

Adjust for the version that you wish to use.

The __rawgit.com__ URL will pull based on the version from GitHub.

The __unpkg.com__ URL will pull based on the version in npmjs.com.

See http://rawgit.com and https://unpkg.com for other ways to retrieve the file.

The factory function can be retrieved from __window.MitchAllen.ConnectionGrid__:

var factory = window.MitchAllen.ConnectionGrid;
console.log(factory);
var xSize = 10, ySize = 5;
var sg = factory.Square( { x: xSize, y: ySize } );
sg.log();

Example:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Connection-Grid Example</title>
<meta name="description" content="Connection Grid Example">
<!-- either cdn should work -->
<!--
<script src="https://cdn.rawgit.com/mitchallen/connection-grid/v0.1.25/dist/connection-grid.min.js"></script>
-->
<script src="https://unpkg.com/@mitchallen/connection-grid@0.1.25/dist/connection-grid.min.js"></script>
<script>
var factory = window.MitchAllen.ConnectionGrid;
console.log(factory);
var xSize = 10, ySize = 5;
var sg = factory.Square( { x: xSize, y: ySize } );
sg.log();
</script>
</head>
<body>
<h1>Connection Grid Example</h1>
</body>
</html>

* * *


* * *

Expand Down Expand Up @@ -265,6 +317,10 @@ Add unit tests for any new or changed functionality. Lint and test your code.

## Version History

#### Version 0.1.25

* Browser now must use __window.MitchAllen.ConnectionGrid__.

#### Version 0.1.24

* Updated CDN URL
Expand Down
192 changes: 0 additions & 192 deletions dist/base.js

This file was deleted.

0 comments on commit 31a8b18

Please sign in to comment.