Browse Source

Initial commit.

master
Starbeamrainbowlabs 6 years ago
commit
ac95236de5
  1. 7
      SillyBundle.js
  2. 18
      SillySay.js
  3. 7
      WordSplitter.js
  4. 28
      index.html
  5. 37
      package.json

7
SillyBundle.js

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
// Import the word splitter from WordSplitter.js
// Note that you don't need to specify the extension - browserify can determine this automatically.
},{}]},{},[1]);

18
SillySay.js

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
"use strict";
// Import the word splitter from WordSplitter.js
// Note that you don't need to specify the extension - browserify can determine this automatically.
import splitWords from './WordSplitter';
function sillySay(sentence) {
// Split the sentence up into words
var words = splitWords(sentence);
// Loop over all the words in the above array and display them one by one
for(let i in words) {
alert(words[i]);
}
}
// Make sillySay accessible from the outside.
window.sillySay = sillySay;

7
WordSplitter.js

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
"use strict";
function splitWords(sentence) {
// Split the sentence on whitespace and return the resulting array
return sentence.split(/\s+/g);
}
export default splitWords;

28
index.html

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Silly Say Demo</title>
</head>
<body>
<p>Silly Say Demo</p>
<p>By <a href="https://starbeamrainbowlabs.com/">Starbeamrainbowlabs</a></p>
<!---------------->
<script src="SillyBundle.js" charset="utf-8"></script>
<script>
window.addEventListener("load", function(event) {
sillySay("This is a test");
});
</script>
<style>
html, body { font-size: 100%; }
body
{
font-family: sans-serif;
}
</style>
</head>
</html>

37
package.json

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
{
"name": "demo-silly-say",
"version": "0.0.1",
"description": "The SillySay.js demo for my blog.",
"main": "SillySay.js",
"scripts": {
"env": "env",
"build": "browserify $npm_package_main -t rollupify -o $npm_package_config_bundle_file",
"build.dev": "browserify $npm_package_main -t rollupify -o $npm_package_config_bundle_file --debug",
"test": "echo There aren't any tests yet!",
"postinstall": "npm run build",
"prestart": "npm run build",
"start": "wzrd $npm_package_main:$npm_package_config_bundle_file & sensible-browser http://localhost:9966",
"stop": "kill $(pgrep --full wzrd)"
},
"repository": {
"type": "git",
"url": "https://git.starbeamrainbowlabs.com/demos/Silly-Say"
},
"keywords": [
"demo",
"example",
"browserify"
],
"author": "Starbeamrainbowlabs <feedback@starbeamrainbowlabs.com>",
"license": "MPL-2.0",
"devDependencies": {
"rollupify": "^0.3.7"
},
"config": {
"bundle_file": "SillyBundle.js"
},
"private": true,
"browserify": {
"transform": [ "rollupify" ]
}
}
Loading…
Cancel
Save