Comparing version 3.0.18 to 3.0.19
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="3.0.19"></a> | ||
## [3.0.19](https://github.com/zerkalica/lom_atom/compare/v3.0.18...v3.0.19) (2017-12-18) | ||
<a name="3.0.18"></a> | ||
@@ -7,0 +12,0 @@ ## [3.0.18](https://github.com/zerkalica/lom_atom/compare/v3.0.17...v3.0.18) (2017-12-18) |
@@ -559,3 +559,3 @@ function _defineProperties(target, props) { | ||
function createAction(host, methodName) { | ||
function createAction(host, methodName, sync) { | ||
function actionFn() { | ||
@@ -567,21 +567,28 @@ var args = arguments; | ||
case 0: | ||
return host[methodName](); | ||
host[methodName](); | ||
break; | ||
case 1: | ||
return host[methodName](args[0]); | ||
host[methodName](args[0]); | ||
break; | ||
case 2: | ||
return host[methodName](args[0], args[1]); | ||
host[methodName](args[0], args[1]); | ||
break; | ||
case 3: | ||
return host[methodName](args[0], args[1], args[2]); | ||
host[methodName](args[0], args[1], args[2]); | ||
break; | ||
case 4: | ||
return host[methodName](args[0], args[1], args[2], args[3]); | ||
host[methodName](args[0], args[1], args[2], args[3]); | ||
break; | ||
case 5: | ||
return host[methodName](args[0], args[1], args[2], args[3], args[4]); | ||
host[methodName](args[0], args[1], args[2], args[3], args[4]); | ||
break; | ||
default: | ||
return host[methodName].apply(host, args); | ||
host[methodName].apply(host, args); | ||
break; | ||
} | ||
@@ -591,2 +598,4 @@ } catch (e) { | ||
} | ||
if (sync) defaultContext.sync(); | ||
} | ||
@@ -598,4 +607,4 @@ | ||
function createSyncedAction(action) { | ||
function syncedAction() { | ||
function createDeferedAction(action) { | ||
function deferedAction() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -605,18 +614,4 @@ args[_key] = arguments[_key]; | ||
action(args); | ||
defaultContext.sync(); | ||
} | ||
syncedAction.displayName = action.displayName + "_synced"; | ||
return syncedAction; | ||
} | ||
function createDeferedAction(action) { | ||
function deferedAction() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
scheduleNative(function () { | ||
return action(args); | ||
return action.apply(void 0, args); | ||
}); | ||
@@ -643,4 +638,4 @@ } | ||
if (definingProperty) return this[hk].bind(this); | ||
var action = createAction(this, hk); | ||
var actionFn = defer ? createDeferedAction(action) : sync ? createSyncedAction(action) : action; | ||
var action = createAction(this, hk, sync); | ||
var actionFn = defer ? createDeferedAction(action) : action; | ||
definingProperty = true; | ||
@@ -647,0 +642,0 @@ Object.defineProperty(this, name, { |
@@ -563,3 +563,3 @@ 'use strict'; | ||
function createAction(host, methodName) { | ||
function createAction(host, methodName, sync) { | ||
function actionFn() { | ||
@@ -571,21 +571,28 @@ var args = arguments; | ||
case 0: | ||
return host[methodName](); | ||
host[methodName](); | ||
break; | ||
case 1: | ||
return host[methodName](args[0]); | ||
host[methodName](args[0]); | ||
break; | ||
case 2: | ||
return host[methodName](args[0], args[1]); | ||
host[methodName](args[0], args[1]); | ||
break; | ||
case 3: | ||
return host[methodName](args[0], args[1], args[2]); | ||
host[methodName](args[0], args[1], args[2]); | ||
break; | ||
case 4: | ||
return host[methodName](args[0], args[1], args[2], args[3]); | ||
host[methodName](args[0], args[1], args[2], args[3]); | ||
break; | ||
case 5: | ||
return host[methodName](args[0], args[1], args[2], args[3], args[4]); | ||
host[methodName](args[0], args[1], args[2], args[3], args[4]); | ||
break; | ||
default: | ||
return host[methodName].apply(host, args); | ||
host[methodName].apply(host, args); | ||
break; | ||
} | ||
@@ -595,2 +602,4 @@ } catch (e) { | ||
} | ||
if (sync) defaultContext.sync(); | ||
} | ||
@@ -602,4 +611,4 @@ | ||
function createSyncedAction(action) { | ||
function syncedAction() { | ||
function createDeferedAction(action) { | ||
function deferedAction() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -609,18 +618,4 @@ args[_key] = arguments[_key]; | ||
action(args); | ||
defaultContext.sync(); | ||
} | ||
syncedAction.displayName = action.displayName + "_synced"; | ||
return syncedAction; | ||
} | ||
function createDeferedAction(action) { | ||
function deferedAction() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
scheduleNative(function () { | ||
return action(args); | ||
return action.apply(void 0, args); | ||
}); | ||
@@ -647,4 +642,4 @@ } | ||
if (definingProperty) return this[hk].bind(this); | ||
var action = createAction(this, hk); | ||
var actionFn = defer ? createDeferedAction(action) : sync ? createSyncedAction(action) : action; | ||
var action = createAction(this, hk, sync); | ||
var actionFn = defer ? createDeferedAction(action) : action; | ||
definingProperty = true; | ||
@@ -651,0 +646,0 @@ Object.defineProperty(this, name, { |
@@ -565,3 +565,3 @@ (function (global, factory) { | ||
function createAction(host, methodName) { | ||
function createAction(host, methodName, sync) { | ||
function actionFn() { | ||
@@ -573,21 +573,28 @@ var args = arguments; | ||
case 0: | ||
return host[methodName](); | ||
host[methodName](); | ||
break; | ||
case 1: | ||
return host[methodName](args[0]); | ||
host[methodName](args[0]); | ||
break; | ||
case 2: | ||
return host[methodName](args[0], args[1]); | ||
host[methodName](args[0], args[1]); | ||
break; | ||
case 3: | ||
return host[methodName](args[0], args[1], args[2]); | ||
host[methodName](args[0], args[1], args[2]); | ||
break; | ||
case 4: | ||
return host[methodName](args[0], args[1], args[2], args[3]); | ||
host[methodName](args[0], args[1], args[2], args[3]); | ||
break; | ||
case 5: | ||
return host[methodName](args[0], args[1], args[2], args[3], args[4]); | ||
host[methodName](args[0], args[1], args[2], args[3], args[4]); | ||
break; | ||
default: | ||
return host[methodName].apply(host, args); | ||
host[methodName].apply(host, args); | ||
break; | ||
} | ||
@@ -597,2 +604,4 @@ } catch (e) { | ||
} | ||
if (sync) defaultContext.sync(); | ||
} | ||
@@ -604,4 +613,4 @@ | ||
function createSyncedAction(action) { | ||
function syncedAction() { | ||
function createDeferedAction(action) { | ||
function deferedAction() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -611,18 +620,4 @@ args[_key] = arguments[_key]; | ||
action(args); | ||
defaultContext.sync(); | ||
} | ||
syncedAction.displayName = action.displayName + "_synced"; | ||
return syncedAction; | ||
} | ||
function createDeferedAction(action) { | ||
function deferedAction() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
scheduleNative(function () { | ||
return action(args); | ||
return action.apply(void 0, args); | ||
}); | ||
@@ -649,4 +644,4 @@ } | ||
if (definingProperty) return this[hk].bind(this); | ||
var action = createAction(this, hk); | ||
var actionFn = defer ? createDeferedAction(action) : sync ? createSyncedAction(action) : action; | ||
var action = createAction(this, hk, sync); | ||
var actionFn = defer ? createDeferedAction(action) : action; | ||
definingProperty = true; | ||
@@ -653,0 +648,0 @@ Object.defineProperty(this, name, { |
{ | ||
"name": "lom_atom", | ||
"version": "3.0.18", | ||
"version": "3.0.19", | ||
"description": "Alternative implementation of eigenmethod mol_atom state management library", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -9,3 +9,3 @@ // @flow | ||
function createAction<Host: Object>(host: Host, methodName: string): (...args: any[]) => void { | ||
function createAction<Host: Object>(host: Host, methodName: string, sync?: boolean): (...args: any[]) => void { | ||
function actionFn(): void { | ||
@@ -15,9 +15,9 @@ const args = arguments | ||
switch (args.length) { | ||
case 0: return host[methodName]() | ||
case 1: return host[methodName](args[0]) | ||
case 2: return host[methodName](args[0], args[1]) | ||
case 3: return host[methodName](args[0], args[1], args[2]) | ||
case 4: return host[methodName](args[0], args[1], args[2], args[3]) | ||
case 5: return host[methodName](args[0], args[1], args[2], args[3], args[4]) | ||
default: return host[methodName].apply(host, args) | ||
case 0: host[methodName](); break | ||
case 1: host[methodName](args[0]); break | ||
case 2: host[methodName](args[0], args[1]); break | ||
case 3: host[methodName](args[0], args[1], args[2]); break | ||
case 4: host[methodName](args[0], args[1], args[2], args[3]); break | ||
case 5: host[methodName](args[0], args[1], args[2], args[3], args[4]); break | ||
default: host[methodName].apply(host, args); break | ||
} | ||
@@ -27,2 +27,3 @@ } catch(e) { | ||
} | ||
if (sync) defaultContext.sync() | ||
} | ||
@@ -34,15 +35,5 @@ | ||
function createSyncedAction(action: (args: any[]) => void) { | ||
function syncedAction(...args: any[]) { | ||
action(args) | ||
defaultContext.sync() | ||
} | ||
syncedAction.displayName = `${action.displayName}_synced` | ||
return syncedAction | ||
} | ||
function createDeferedAction(action: (args: any[]) => void) { | ||
function deferedAction(...args: any[]) { | ||
scheduleNative(() => action(args)) | ||
scheduleNative(() => action(...args)) | ||
} | ||
@@ -74,6 +65,6 @@ deferedAction.displayName = `${action.displayName}_defered` | ||
const action = createAction(this, hk) | ||
const action = createAction(this, hk, sync) | ||
const actionFn = defer | ||
? createDeferedAction(action) | ||
: (sync ? createSyncedAction(action) : action) | ||
: action | ||
@@ -80,0 +71,0 @@ definingProperty = true |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
329499
3370