示例#1
0
 public void InitEngine()
 {
     engine.Dispose();
     engine   = new V8Engine();
     commands = new Command(this);
     engine.GlobalObject.SetProperty("Plugin", this, "Plugin", null, ScriptMemberSecurity.Locked);
     engine.GlobalObject.SetProperty("Command", commands, "Command", true, ScriptMemberSecurity.Locked);
 }
示例#2
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged
        /// resources.
        /// </summary>
        public void Dispose()
        {
            GC.SuppressFinalize(this);

            if (null != _engine)
            {
                _engine.Dispose();
                _engine = null;
            }
        }
示例#3
0
        public void Dispose()
        {
            if (!isDisposing && !v8.IsDisposed)
            {
                isDisposing = true;

                ExecuteGlobalScriptFunction("shutdown");

                // SHUTDOWN all scripts
                GC.WaitForPendingFinalizers();
                GC.Collect();
                v8.ForceV8GarbageCollection();
                v8.Dispose();

                // Notify engine that we have terminated
                OnShutdown();
            }
        }