@r7kamura/cycle-history-driver
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.makeHistoryDriver = makeHistoryDriver; | ||
exports['default'] = makeHistoryDriver; | ||
@@ -29,2 +29,4 @@ var _cycleCore = require('@cycle/core'); | ||
}; | ||
} | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "@r7kamura/cycle-history-driver", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A Cycle.js Driver to manage the browser history.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/r7kamura/cycle-history-driver", |
@@ -12,2 +12,3 @@ # cycle-history-driver | ||
import Cycle from '@cycle/core'; | ||
import { makeDOMDriver } from '@cycle/dom' | ||
import { makeHistoryDriver } from '@r7kamura/cycle-history-driver'; | ||
@@ -27,2 +28,3 @@ | ||
// In your view function, you need to prepare an Observable that emits Object{url} for push-state. | ||
// This Observable must be returned from your main function. | ||
const historyRecord$ = DOM.select('a.your-internal-anchor').events('click').map((event) => { | ||
@@ -37,3 +39,4 @@ event.preventDefault(); | ||
// In your intent function, you can subscribe history to react to pop-state events. | ||
// This Observable can be accessed from your main function's arguments. | ||
history.map(_ => window.location.href).map((url) => { /* ... */ }); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3940
30
40