@aws-amplify/core
Advanced tools
Comparing version 1.0.24 to 1.0.25-beta.0
@@ -6,2 +6,29 @@ # Change Log | ||
<a name="1.0.25-beta.0"></a> | ||
## [1.0.25-beta.0](https://github.com/aws/aws-amplify/compare/@aws-amplify/core@1.0.25-unstable.1...@aws-amplify/core@1.0.25-beta.0) (2019-04-04) | ||
**Note:** Version bump only for package @aws-amplify/core | ||
<a name="1.0.25-unstable.1"></a> | ||
## [1.0.25-unstable.1](https://github.com/aws/aws-amplify/compare/@aws-amplify/core@1.0.25-unstable.0...@aws-amplify/core@1.0.25-unstable.1) (2019-04-04) | ||
### Bug Fixes | ||
* **@aws-amplify/core:** fix hub this binding issue ([#3002](https://github.com/aws/aws-amplify/issues/3002)) ([8fba1a2](https://github.com/aws/aws-amplify/commit/8fba1a2)) | ||
<a name="1.0.25-unstable.0"></a> | ||
## [1.0.25-unstable.0](https://github.com/aws/aws-amplify/compare/@aws-amplify/core@1.0.24...@aws-amplify/core@1.0.25-unstable.0) (2019-04-02) | ||
**Note:** Version bump only for package @aws-amplify/core | ||
<a name="1.0.24"></a> | ||
@@ -8,0 +35,0 @@ ## [1.0.24](https://github.com/aws/aws-amplify/compare/@aws-amplify/core@1.0.24-unstable.1...@aws-amplify/core@1.0.24) (2019-03-28) |
@@ -1,9 +0,1 @@ | ||
interface IPattern { | ||
pattern: RegExp; | ||
callback: HubCallback; | ||
} | ||
interface IListener { | ||
name: string; | ||
callback: HubCallback; | ||
} | ||
export declare type HubCapsule = { | ||
@@ -26,4 +18,4 @@ channel: string; | ||
name: string; | ||
listeners: IListener[]; | ||
patterns: IPattern[]; | ||
private listeners; | ||
private patterns; | ||
protectedChannels: string[]; | ||
@@ -30,0 +22,0 @@ constructor(name: string); |
@@ -25,2 +25,4 @@ "use strict"; | ||
var logger = new Logger_1.ConsoleLogger('Hub'); | ||
var AMPLIFY_SYMBOL = ((typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') ? | ||
Symbol.for('amplify_default') : '@@amplify_default'); | ||
function isLegacyCallback(callback) { | ||
@@ -64,3 +66,3 @@ return callback.onHubCapsule !== undefined; | ||
if (this.protectedChannels.indexOf(channel) > -1) { | ||
var hasAccess = ampSymbol === Symbol.for('amplify_default'); | ||
var hasAccess = ampSymbol === AMPLIFY_SYMBOL; | ||
if (!hasAccess) { | ||
@@ -89,3 +91,3 @@ logger.warn("WARNING: " + channel + " is protected and dispatching on it can have unintended consequences"); | ||
logger.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."); | ||
cb = callback.onHubCapsule; | ||
cb = callback.onHubCapsule.bind(callback); | ||
} | ||
@@ -92,0 +94,0 @@ else if (typeof callback !== 'function') { |
{ | ||
"name": "@aws-amplify/core", | ||
"version": "1.0.24", | ||
"version": "1.0.25-beta.0", | ||
"description": "Core category of aws-amplify", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -18,2 +18,4 @@ /* | ||
const AMPLIFY_SYMBOL = ((typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') ? | ||
Symbol.for('amplify_default') : '@@amplify_default') as Symbol; | ||
interface IPattern { | ||
@@ -33,3 +35,3 @@ pattern: RegExp, | ||
source: string, | ||
patternInfo?: string[] | ||
patternInfo?: string[] | ||
}; | ||
@@ -53,4 +55,4 @@ | ||
name: string; | ||
listeners: IListener[] = []; | ||
patterns: IPattern[] = []; | ||
private listeners: IListener[] = []; | ||
private patterns: IPattern[] = []; | ||
@@ -85,3 +87,3 @@ protectedChannels = ['core', 'auth', 'api', 'analytics', 'interactions', 'pubsub', 'storage', 'xr']; | ||
if (this.protectedChannels.indexOf(channel) > -1) { | ||
const hasAccess = ampSymbol === Symbol.for('amplify_default'); | ||
const hasAccess = ampSymbol === AMPLIFY_SYMBOL; | ||
@@ -110,3 +112,3 @@ if (!hasAccess) { | ||
logger.warn(`WARNING onHubCapsule is Deprecated. Please pass in a callback.`); | ||
cb = callback.onHubCapsule; | ||
cb = callback.onHubCapsule.bind(callback); | ||
} else if (typeof callback !== 'function') { | ||
@@ -153,3 +155,3 @@ throw new Error('No callback supplied to Hub'); | ||
if (this.patterns.length > 0) { | ||
if (!payload.message) { | ||
@@ -164,5 +166,5 @@ logger.warn(`Cannot perform pattern matching without a message key`); | ||
const match = payloadStr.match(pattern.pattern); | ||
if (match){ | ||
if (match) { | ||
const [, ...groups] = match; | ||
const dispatchingCapsule:HubCapsule = {...capsule, patternInfo:groups}; | ||
const dispatchingCapsule: HubCapsule = { ...capsule, patternInfo: groups }; | ||
try { | ||
@@ -169,0 +171,0 @@ pattern.callback(dispatchingCapsule); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4121001
33439
1