mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-18 21:50:54 +08:00
102 lines
3.3 KiB
Objective-C
102 lines
3.3 KiB
Objective-C
/*!
|
|
* iOS SDK
|
|
*
|
|
* Tencent is pleased to support the open source community by making
|
|
* Hippy available.
|
|
*
|
|
* Copyright (C) 2019 THL A29 Limited, a Tencent company.
|
|
* All rights reserved.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import "HPInvalidating.h"
|
|
|
|
@protocol HippyBridgeMethod;
|
|
@protocol HippyBridgeModule;
|
|
@class HippyBridge;
|
|
|
|
@interface HippyModuleData : NSObject <HPInvalidating>
|
|
|
|
- (instancetype)initWithModuleClass:(Class)moduleClass bridge:(HippyBridge *)bridge;
|
|
|
|
- (instancetype)initWithModuleInstance:(id<HippyBridgeModule>)instance bridge:(HippyBridge *)bridge;
|
|
|
|
/**
|
|
* Calls `constantsToExport` on the module and stores the result. Note that
|
|
* this will init the module if it has not already been created. This method
|
|
* can be called on any thread, but may block the main thread briefly if the
|
|
* module implements `constantsToExport`.
|
|
*/
|
|
- (void)gatherConstants;
|
|
|
|
@property (nonatomic, strong, readonly) Class moduleClass;
|
|
@property (nonatomic, copy, readonly) NSString *name;
|
|
|
|
/**
|
|
* Returns the module methods. Note that this will gather the methods the first
|
|
* time it is called and then memoize the results.
|
|
*/
|
|
@property (nonatomic, copy, readonly) NSArray<id<HippyBridgeMethod>> *methods;
|
|
|
|
@property (nonatomic, copy, readonly) NSDictionary<NSString *, id<HippyBridgeMethod>> *methodsByName;
|
|
|
|
/**
|
|
* Returns YES if module instance has already been initialized; NO otherwise.
|
|
*/
|
|
@property (nonatomic, assign, readonly) BOOL hasInstance;
|
|
|
|
/**
|
|
* Returns YES if module instance must be created on the main thread.
|
|
*/
|
|
@property (nonatomic, assign, readonly) BOOL requiresMainQueueSetup;
|
|
|
|
/**
|
|
* Returns YES if module has constants to export.
|
|
*/
|
|
@property (nonatomic, assign, readonly) BOOL hasConstantsToExport;
|
|
|
|
/**
|
|
* Returns the current module instance. Note that this will init the instance
|
|
* if it has not already been created. To check if the module instance exists
|
|
* without causing it to be created, use `hasInstance` instead.
|
|
*/
|
|
@property (nonatomic, strong, readonly) id<HippyBridgeModule> instance;
|
|
|
|
/**
|
|
* Returns the module method dispatch queue. Note that this will init both the
|
|
* queue and the module itself if they have not already been created.
|
|
*/
|
|
@property (strong, readonly) dispatch_queue_t methodQueue;
|
|
|
|
/**
|
|
* Returns the module config. Calls `gatherConstants` internally, so the same
|
|
* usage caveats apply.
|
|
*/
|
|
@property (nonatomic, copy, readonly) NSArray *config;
|
|
|
|
/**
|
|
* Whether the receiver has a valid `instance` which implements -batchDidComplete.
|
|
*/
|
|
@property (nonatomic, assign, readonly) BOOL implementsBatchDidComplete;
|
|
|
|
/**
|
|
* Whether the receiver has a valid `instance` which implements
|
|
* -partialBatchDidFlush.
|
|
*/
|
|
@property (nonatomic, assign, readonly) BOOL implementsPartialBatchDidFlush;
|
|
|
|
@end
|