Skip to content

Commit

Permalink
Prepared Pollymer for npm and jspm, bumped version to 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
harmony7 committed Nov 26, 2015
1 parent 16c672b commit d67ef11
Show file tree
Hide file tree
Showing 21 changed files with 3,074 additions and 600 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
jspm_packages/
lib/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
jspm_packages/
src/
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Pollymer Changelog
v. 1.0.0 (01-31-2013) - Initial Release.
v. 1.1.0 (04-28-2014) - Support for RequireJS (AMD).
v. 1.1.1 (05-10-2014) - Fixed crashing issue when abort() called on fresh object.
v. 1.1.2 (05-10-2014) - Adding access to "lastRequest" info.
v. 1.1.2 (05-10-2014) - Adding access to "lastRequest" info.
v. 1.1.3 (11-27-2015) - npm availability, new on() semantics.
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
VERSION = 1.1.1
VERSION = 1.1.3

all: dist

distclean:
rm -f pollymer-$(VERSION).js pollymer-$(VERSION).min.js
all: clean build lib

clean:
- rm -r dist/
- rm -r lib/

dist: pollymer-$(VERSION).min.js
build:
mkdir dist
jspm bundle-sfx browser.js dist/pollymer-${VERSION}.js
./node_modules/.bin/uglifyjs dist/pollymer-${VERSION}.js -o dist/pollymer-${VERSION}.min.js

pollymer-$(VERSION).js: pollymer.js
cp pollymer.js pollymer-$(VERSION).js
lib:
mkdir lib
./node_modules/.bin/babel --presets es2015 -d lib/ src/

pollymer-$(VERSION).min.js: pollymer-$(VERSION).js
sed -e "s/DEBUG = true/DEBUG = false/g" pollymer-$(VERSION).js | ./compile.py > pollymer-$(VERSION).min.js.tmp
mv pollymer-$(VERSION).min.js.tmp pollymer-$(VERSION).min.js
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Pollymer is offered under the MIT license. See the COPYING file.
Dependencies
------------

* json2.js
None, but if you need to support a browser that does not natively provide support for JSON (such as IE7 or lower),
then you should use the [json2.js polyfill](https://github.com/douglascrockford/JSON-js).

Available Transports
--------------------
Expand All @@ -35,6 +36,13 @@ Limitations
Usage
-----

For use in a browser script tag (`Pollymer` becomes a global variable), use the pollymer-1.x.x.min.js file in the dist/ directory.
The non-minified file and sourcemap are also available.

For browserify, use `npm install pollymer`, then `var Pollymer = require('pollymer');`.

For jspm, use 'jspm install github:fanout/pollymer', then `import Pollymer from 'fanout/pollymer';`.

```javascript
var req = new Pollymer.Request();
req.on('finished', function(code, result, headers) { ... });
Expand All @@ -51,6 +59,7 @@ Methods of Request Object
* on(event_name, callback) - Add callback for event:
+ event_name: name of event
+ callback: method to call when event occurs
+ This method returns a function that can be called to remove this callback from the event.

* available events:
+ 'finished': function(code, result, headers)
Expand All @@ -60,7 +69,8 @@ Methods of Request Object
+ 'error': function(reason)
- reason: Pollymer.errorType

* off(event_name) - Remove callback for event
* off(event_name) - Remove callback for event.
+ Alternatively, call the function that is returned from on().

* start(method, url, headers, body) - start request
+ method: name of method (e.g. 'GET')
Expand All @@ -70,9 +80,11 @@ Methods of Request Object
+ Sometime after the request has been started, a finished or error event will be raised and the object will return to inactive state (unless the recurring flag is set, see below).
+ The start method may be called again once the request has completed (unless the recurring flag is set, see below). If called again on the same object, a short random delay will be added before performing the request.

* retry() - Attempt the exact same request again. Normally, Pollymer will automatically retry a request that it considers to be a failure, but this method may be used if the application needs to retry the request for any another reason. Retries have an exponentially increasing delay between them. Do not use retry() if the previous request attempt was considered to be successful, as it will add penalizing delays that you probably don't want in that case.
* retry() - Attempt the exact same request again.
+ Normally, Pollymer will automatically retry a request that it considers to be a failure, but this method may be used if the application needs to retry the request for any another reason. Retries have an exponentially increasing delay between them. Do not use retry() if the previous request attempt was considered to be successful, as it will add penalizing delays that you probably don't want in that case.

* abort() - Stop any current request and return the object to inactive state.
* abort() - Stop any current request.
+ This returns the object to inactive state.

Properties of Request Object
----------------------------
Expand Down
3 changes: 3 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Pollymer from './src/Pollymer.js'

window.Pollymer = Pollymer;
1 change: 1 addition & 0 deletions commonjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib/Pollymer.js').default;
24 changes: 0 additions & 24 deletions compile.py

This file was deleted.

58 changes: 58 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},

map: {
"babel": "npm:babel-core@5.8.34",
"babel-runtime": "npm:babel-runtime@5.8.34",
"core-js": "npm:core-js@1.2.6",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.2": {
"process": "npm:process@0.11.2"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:babel-runtime@5.8.34": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:core-js@1.2.6": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:process@0.11.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
}
}
});
Loading

0 comments on commit d67ef11

Please sign in to comment.