Skip to content

[enhancement] support for Array in source_origin #15

Description

@erich-roncarolo

Maybe source_origin could support also arrays.
In this way receiveMessage() can be invoked in following way:

$.receiveMessage(function(e) {
    ....
}, [
    'http://example.com',
    'http://test.example.com',
    'https://example.com'
]);

The change should be simple, just add following line in receiveMessage() between line 182 and line 183.

182       if ( ( typeof source_origin === 'string' && e.origin !== source_origin )
==>         || ( $.isArray( source_origin ) && $.inArray( e.origin, source_origin ) === -1 )
183         || ( $.isFunction( source_origin ) && source_origin( e.origin ) === FALSE ) ) {
184         return FALSE;
185       }

Regards
-Erich

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions