backbone-machina
Advanced tools
Comparing version
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', 'backbone', 'lodash', 'machina'], factory); | ||
define(["exports", "backbone", "lodash", "machina"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('backbone'), require('lodash'), require('machina')); | ||
factory(exports, require("backbone"), require("lodash"), require("machina")); | ||
} else { | ||
@@ -13,33 +13,49 @@ var mod = { | ||
} | ||
})(this, function (exports, _backbone, _lodash, _machina) { | ||
'use strict'; | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _backbone, _lodash, _machina) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
// Generated by CoffeeScript 2.3.1 | ||
var BackboneFsm; | ||
_exports["default"] = void 0; | ||
// Generated by CoffeeScript 2.5.0 | ||
var BackboneFsm, mirrorStar; | ||
exports.default = BackboneFsm = _machina.Fsm.extend({ | ||
var _default = BackboneFsm = _machina.Fsm.extend({ | ||
constructor: function constructor() { | ||
var _this = this; | ||
_machina.Fsm.apply(this, arguments); | ||
_machina.Fsm.apply(this, arguments); | ||
this.on('transition', function (_ref) { | ||
this._events = mirrorStar(this._events || {}); | ||
this.on(this.eventListeners); | ||
this.eventListeners = this._events; | ||
return this; | ||
}, | ||
eventListeners: { | ||
transition: function transition(_ref) { | ||
var fromState = _ref.fromState, | ||
toState = _ref.toState, | ||
action = _ref.action; | ||
_this.emit('exit:' + fromState, _this, action); | ||
return _this.emit('enter:' + toState, _this, action); | ||
}); | ||
return this; | ||
this.emit("exit:".concat(fromState), this, action); | ||
return this.emit("enter:".concat(toState), this, action); | ||
} | ||
} | ||
}); | ||
_exports["default"] = _default; | ||
(0, _lodash.extend)(BackboneFsm.prototype, _backbone.Events, { | ||
emit: _backbone.Events.trigger | ||
}); | ||
(0, _lodash.extend)(BackboneFsm.prototype, _backbone.Events); | ||
BackboneFsm.prototype.emit = BackboneFsm.prototype.trigger; | ||
mirrorStar = function mirrorStar(eventMap) { | ||
Object.defineProperty(eventMap, '*', { | ||
get: function get() { | ||
return this.all; | ||
}, | ||
set: function set(newValue) { | ||
return this.all = newValue; | ||
} | ||
}); | ||
return eventMap; | ||
}; | ||
}); | ||
//# sourceMappingURL=backbone-machina.js.map |
{ | ||
"name": "backbone-machina", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "machina.Fsm dressed as a fourth Backbone pillar next to Model, View and Router", | ||
@@ -16,4 +16,4 @@ "keywords": [ | ||
], | ||
"bugs": "https://github.com/jgonggrijp/backbone-machina/issues", | ||
"repository": "github:jgonggrijp/backbone-machina", | ||
"bugs": "https://gitlab.com/jgonggrijp/backbone-machina/issues", | ||
"repository": "gitlab:jgonggrijp/backbone-machina", | ||
"author": "Julian Gonggrijp <dev@juliangonggrijp.com>", | ||
@@ -36,20 +36,20 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"backbone": "^1.3.3", | ||
"lodash": "^4.17.10", | ||
"machina": "^2.0.2" | ||
"backbone": "^1.4.0", | ||
"lodash": "^4.17.15", | ||
"machina": "^4.0.2" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.26.3", | ||
"babel-plugin-transform-es2015-modules-umd": "^6.24.1", | ||
"babel-preset-env": "^1.7.0", | ||
"coffeescript": "^2.3.1", | ||
"jasmine": "^3.2.0" | ||
"@babel/core": "^7.8.3", | ||
"@babel/plugin-transform-modules-umd": "^7.8.3", | ||
"@babel/preset-env": "^7.8.3", | ||
"coffeescript": "^2.5.0", | ||
"jasmine": "^3.5.0" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"env" | ||
"@babel/env" | ||
], | ||
"plugins": [ | ||
[ | ||
"transform-es2015-modules-umd", | ||
"@babel/transform-modules-umd", | ||
{ | ||
@@ -56,0 +56,0 @@ "globals": { |
@@ -8,5 +8,14 @@ # backbone-machina | ||
[](https://travis-ci.org/jgonggrijp/backbone-machina) | ||
[![pipeline status][shield-pipeline]][build] [![latest version on npm][shield-npm]][npm] [![code hosted on GitLab][shield-gitlab]][code] [![issue tracker on GitLab][shield-issues]][tracker] [![author: Julian Gonggrijp][shield-jgonggrijp]][jgonggrijp] [![license text][shield-license]][license] [![made with CoffeeScript][shield-coffee]][coffeescript] [![changelog][shield-changelog]][changelog] | ||
[code]: https://gitlab.com/jgonggrijp/backbone-machina | ||
[tracker]: https://gitlab.com/jgonggrijp/backbone-machina/issues | ||
[license]: https://gitlab.com/jgonggrijp/backbone-machina/blob/master/LICENSE | ||
[changelog]: https://gitlab.com/jgonggrijp/backbone-machina/blob/master/CHANGELOG.md | ||
[build]: https://gitlab.com/jgonggrijp/backbone-machina/commits/master | ||
[npm]: https://www.npmjs.com/package/backbone-machina | ||
[jgonggrijp]: https://juliangonggrijp.com | ||
[coffeescript]: https://coffeescript.org/ | ||
## Quickstart | ||
@@ -28,2 +37,4 @@ | ||
*New in version 1.1.0:* `BackboneFsm` is truly 100% compatible with both interfaces it extends. You can use `'*'` and `'all'` interchangeably as wildcards when subscribing to events. `machina.Fsm`’s `eventListeners` option is supported as well. As a result, `BackboneFsm` can now be used in hierarchical settings as a drop-in replacement for `machina.Fsm`. | ||
[3]: https://github.com/ifandelse/machina.js/wiki/API | ||
@@ -54,14 +65,11 @@ [4]: https://backbonejs.org/#Events | ||
[5]: https://github.com/jgonggrijp/backbone-machina/wiki/Backbone-project-organization-philosophy | ||
[5]: https://gitlab.com/jgonggrijp/backbone-machina/-/wikis/Backbone-project-organization-philosophy | ||
## Limitations | ||
*Please consult the [issue list][6] for the most up-to-date information on bugs and missing features.* | ||
- `machina.Fsm`'s `eventListeners` option is currently not supported. [#1][7] | ||
- There is no `machina.BehavioralFsm` variant. [#2][8] | ||
[6]: https://github.com/jgonggrijp/backbone-machina/issues | ||
[7]: https://github.com/jgonggrijp/backbone-machina/issues/1 | ||
[8]: https://github.com/jgonggrijp/backbone-machina/issues/2 | ||
[shield-pipeline]: https://gitlab.com/jgonggrijp/backbone-machina/badges/master/pipeline.svg | ||
[shield-npm]: https://img.shields.io/npm/v/backbone-machina | ||
[shield-gitlab]: https://img.shields.io/badge/-GitLab-555?logo=gitlab | ||
[shield-issues]: https://img.shields.io/badge/-issues-555?logo=gitlab | ||
[shield-changelog]: https://img.shields.io/badge/-changelog-555?logo=gitlab | ||
[shield-jgonggrijp]: https://img.shields.io/badge/author-Julian_Gonggrijp-708 | ||
[shield-license]: https://img.shields.io/npm/l/backbone-machina | ||
[shield-coffee]: https://img.shields.io/badge/-CoffeeScript-2F2625?logo=CoffeeScript |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
11674
43.86%6
20%55
48.65%73
12.31%+ Added
- Removed
- Removed
Updated
Updated
Updated