Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tarojs/taro

Package Overview
Dependencies
Maintainers
2
Versions
952
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tarojs/taro - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

src/.DS_Store

2

package.json
{
"name": "@tarojs/taro",
"version": "0.0.22",
"version": "0.0.23",
"description": "Taro framework",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,22 +0,2 @@

import { isEmptyObject } from './util'
import { enqueueRender } from './render-queue'
import { updateComponent } from './lifecycle'
class Component {
static defaultProps = {}
$components = {}
$$components = {}
$router = {
params: {}
}
$path = ''
$name = ''
$isComponent = true
$props = {}
nextProps = {}
_dirty = true
_disable = true
_pendingStates = []
_pendingCallbacks = []
constructor (props) {

@@ -26,92 +6,4 @@ this.state = {}

}
_initData ($root, $parent) {
this.$app = getApp()
this.$root = $root || null
this.$parent = $parent || null
this.defaultData = {}
this.$data = $parent ? $parent.$data : {}
let path = this.$path.split('$$').pop()
this.$data[`$$${path}`] = this.$data[`$$${path}`] || {}
this.$data = this.$data[`$$${path}`]
for (let k in this.state) {
this.$data[k] = this.state[k]
}
if (this.props) {
for (let k in this.props) {
if (typeof this.props[k] !== 'function') {
this.$data[k] = this.props[k]
}
}
}
if (this.$$components && !isEmptyObject(this.$$components)) {
Object.getOwnPropertyNames(this.$$components).forEach(name => {
this.$$components[name]._initData(this.$root || this, this)
})
}
if (this.$$dynamicComponents && !isEmptyObject(this.$$dynamicComponents)) {
Object.getOwnPropertyNames(this.$$dynamicComponents).forEach(name => {
this.$$dynamicComponents[name]._initData(this.$root || this, this)
})
}
}
_init (scope) {
this.$scope = scope
this.$app = getApp()
if (this.$$components && !isEmptyObject(this.$$components)) {
Object.getOwnPropertyNames(this.$$components).forEach(name => {
this.$$components[name]._init(this.$scope)
})
}
if (this.$$dynamicComponents && !isEmptyObject(this.$$dynamicComponents)) {
Object.getOwnPropertyNames(this.$$dynamicComponents).forEach(name => {
this.$$dynamicComponents[name]._init(this.$scope)
})
}
}
// rewrite when compile
_createData () {
return this.state
}
setState (state, callback) {
if (state) {
(this._pendingStates = this._pendingStates || []).push(state)
}
if (typeof callback === 'function') {
(this._pendingCallbacks = this._pendingCallbacks || []).push(callback)
}
if (!this._disable) {
enqueueRender(this)
}
}
getState () {
const { _pendingStates, state, props } = this
const stateClone = Object.assign({}, state)
delete stateClone.__data
if (!_pendingStates.length) {
return stateClone
}
const queue = _pendingStates.concat()
this._pendingStates.length = 0
queue.forEach((nextState) => {
if (typeof nextState === 'function') {
nextState = nextState.call(this, stateClone, props)
}
Object.assign(stateClone, nextState)
})
return stateClone
}
forceUpdate (callback) {
if (typeof callback === 'function') {
(this._pendingCallbacks = this._pendingCallbacks || []).push(callback)
}
updateComponent(this, true)
}
}
export default Component
/* eslint-disable camelcase */
import Component from './component'
import createApp from './create-app'
import createPage from './create-page'
import initNativeApi from './native-api'
import { get as internal_safe_get } from './internal/safe-get'
import { dynamicRecursive as internal_dynamic_recursive } from './internal/dynamic-recursive'
import { getEnv, ENV_TYPE } from './util'
import { getEnv, ENV_TYPE } from './env'
export {
Component,
createApp,
createPage,
initNativeApi,
getEnv,

@@ -23,5 +17,2 @@ ENV_TYPE,

Component,
createApp,
createPage,
initNativeApi,
getEnv,

@@ -28,0 +19,0 @@ ENV_TYPE,

@@ -1,20 +0,1 @@

export const ENV_TYPE = {
WEAPP: 'WEAPP',
WEB: 'WEB',
RN: 'RN'
}
export function getEnv () {
if (typeof wx !== 'undefined' && wx.getSystemInfo) {
return ENV_TYPE.WEAPP
}
if (typeof window !== 'undefined') {
return ENV_TYPE.WEB
}
if (typeof global !== 'undefined' && global.ErrorUtils) {
return ENV_TYPE.RN
}
return 'Unknown environment'
}
export function isEmptyObject (obj) {

@@ -21,0 +2,0 @@ if (!obj) {

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 too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc