Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Security Support ends in January 2023. Read version 5.0 (the latest LTS version) of the Oro documentation to get the updated information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

MultiUseResourceManager ⇐ BaseClass

Allows to create/remove resource that could be used by multiple holders.

Use case:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 var backdropManager = new MultiUseResourceManager({
     listen: {
         'constructResource': function() {
             $(document.body).addClass('backdrop');
         },
         'disposeResource': function() {
             $(document.body).removeClass('backdrop');
         }
     }
 });

 // 1. case with Ids
 var holderId = backdropManager.hold();
 // then somewhere
 backdropManager.release(holderId);

 // 2. case with holder object
 backdropManager.hold(this);
 // then somewhere, please note that link to the same object should be provided
 backdropManager.release(this);

 // 2. case with holder identifier
 backdropManager.hold(this.cid);
 // then somewhere, please note that link to the same object should be provided
 backdropManager.release(this.cid);

Extends: BaseClass

multiUseResourceManager.counter : number

Holders counter

Kind: instance property of MultiUseResourceManager Access: protected

multiUseResourceManager.isCreated : boolean

True if resource is created

Kind: instance property of MultiUseResourceManager

multiUseResourceManager.holders : Array

Array of ids of current resource holders

Kind: instance property of MultiUseResourceManager

multiUseResourceManager.constructor()

Kind: instance method of MultiUseResourceManager

multiUseResourceManager.hold(holder) ⇒ *

Holds resource

Kind: instance method of MultiUseResourceManager Returns: * - holder identifier

Param Type Description
holder * holder identifier

multiUseResourceManager.release(id)

Releases resource

Kind: instance method of MultiUseResourceManager

Param Type Description
id * holder identifier

multiUseResourceManager.isReleased(id) ⇒ boolean

Returns true if resource holder has been already released

Kind: instance method of MultiUseResourceManager

Param Type Description
id * holder identifier

multiUseResourceManager.checkState()

Check state, creates or disposes resource if required

Kind: instance method of MultiUseResourceManager Access: protected

multiUseResourceManager.dispose()

Kind: instance method of MultiUseResourceManager